Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using option report with just a filename results in exception #834

Closed
Styxxy opened this issue Oct 16, 2020 · 1 comment · Fixed by #842
Closed

Using option report with just a filename results in exception #834

Styxxy opened this issue Oct 16, 2020 · 1 comment · Fixed by #842
Labels
Bug This issue describes behavior that is not working as expected
Milestone

Comments

@Styxxy
Copy link
Contributor

Styxxy commented Oct 16, 2020

When I run the dotnet format command with the report option, and I specify only a filename, the tool ends with an exception. Expected behaviour is that the report file is generated in the current directory.

Command:

C:\Temp>dotnet format C:\path-to\my-repository\ --folder --check --report dotnet-format-report.json

Error:

Unhandled exception: System.ArgumentException: Path cannot be the empty string or all whitespace. (Parameter 'path')
   at System.IO.Directory.CreateDirectory(String path)
   at Microsoft.CodeAnalysis.Tools.ReportWriter.Write(String reportPath, IEnumerable`1 formattedFiles, ILogger logger) in /_/src/ReportWriter.cs:line 23
   at Microsoft.CodeAnalysis.Tools.CodeFormatter.FormatWorkspaceAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, Boolean createBinaryLog) in /_/src/CodeFormatter.cs:line 107
   at Microsoft.CodeAnalysis.Tools.Program.Run(String workspace, Boolean folder, String fixStyle, String fixAnalyzers, String verbosity, Boolean check, String[] include, String[] exclude, String report, Boolean includeGenerated, IConsole console) in /_/src/Program.cs:line 150
   at System.CommandLine.Invocation.CommandHandler.GetResultCodeAsync(Object value, InvocationContext context)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseErrorReporting>b__21_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__22_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseDirective>b__20_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__11_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()
@Styxxy Styxxy changed the title Using option report with just a filename specified results in exception Using option report with just a filename results in exception Oct 16, 2020
JoeRobich added a commit that referenced this issue Oct 19, 2020
Fixes #834 : error reportfile without directory specified
@JoeRobich JoeRobich added the Bug This issue describes behavior that is not working as expected label Oct 19, 2020
@jmarolf jmarolf added this to the 5.0 milestone Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This issue describes behavior that is not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants