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

"Failed to apply code fix MisplacedUsingDirectivesCodeFixProvider for IDE0065" NRE But Does Not Return Non-Zero Exit Code #838

Closed
aolszowka opened this issue Oct 19, 2020 · 2 comments

Comments

@aolszowka
Copy link

I have my .editorconfig set like so:

# IDE0065: Misplaced using directive
csharp_using_directive_placement = inside_namespace:warning

When attempting to run dotnet format I encounter a NRE when attempting to check this; furthermore this does not return a non-zero exit code which allows this to pass the CI.

C:\GitHub\ManipulativeReplacer>dotnet format --fix-style warn --fix-analyzers warn --check
  Formatting code files in workspace 'C:\GitHub\ManipulativeReplacer\ManipulativeReplacer.sln'.
  Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings.
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(1,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(2,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(3,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(4,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(5,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(6,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(7,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(8,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\Program.cs(1,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\Program.cs(2,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\Program.cs(3,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\Program.cs(4,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\Program.cs(5,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  Failed to apply code fix MisplacedUsingDirectivesCodeFixProvider for IDE0065: Object reference not set to an instance of an object.
  Format complete in 3824ms.

C:\GitHub\ManipulativeReplacer>echo %errorlevel%
0

My version is as follows:

C:\GitHub\ManipulativeReplacer>dotnet format --version
5.0.142902+8012f4ede1bb9a4e90ac01efd204b0f1ee428f10

Running in Diagnostic verbosity does not return anything more:

C:\GitHub\ManipulativeReplacer>dotnet format --fix-style warn --fix-analyzers warn -v diag --check
  The dotnet runtime version is '3.1.9'.
  The dotnet CLI version is '3.1.403'.
  Using MSBuild.exe located in 'C:\Program Files\dotnet\sdk\3.1.403\'.
  Formatting code files in workspace 'C:\GitHub\ManipulativeReplacer\ManipulativeReplacer.sln'.
  Loading workspace.
  Complete in 1649ms.
  Determining formattable files.
  Complete in 376ms.
  Running formatters.
  Running Code Style analysis.
  Determining diagnostics...
  Running 9 analyzers on ManipulativeReplacer.
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(1,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(2,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(3,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(4,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(5,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(6,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(7,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\AboutManipulativeReplacerBox.cs(8,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\Program.cs(1,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\Program.cs(2,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\Program.cs(3,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\Program.cs(4,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  ManipulativeReplacer\Program.cs(5,1): Using directives must be placed inside of a namespace declaration (IDE0065)
  Complete in 1295ms.
  Fixing diagnostics...
  Running 1 analyzers on ManipulativeReplacer.
  Failed to apply code fix MisplacedUsingDirectivesCodeFixProvider for IDE0065: Object reference not set to an instance of an object.
  Complete in 88ms.
  Analysis complete in 1384ms.
  Complete in 1789ms.
  Formatted 0 of 11 files.
  Format complete in 3815ms.

C:\GitHub\ManipulativeReplacer>echo %errorlevel%
0
@JoeRobich
Copy link
Member

@aolszowka We've had an issue with publishing our rolling builds that is now resolved. Please give https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&package=dotnet-format&protocolType=NuGet&version=5.0.151902 a try as I think this issue was resolved with #776

@aolszowka
Copy link
Author

I can confirm that this particular issue was resolved as of 5.0.151902.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants