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

SA1107 Fix All in Solution appears to throw an exception #1992

Closed
sharwell opened this issue Dec 23, 2015 · 1 comment
Closed

SA1107 Fix All in Solution appears to throw an exception #1992

sharwell opened this issue Dec 23, 2015 · 1 comment
Assignees
Labels

Comments

@sharwell
Copy link
Member

I'm working with Newtonsoft.Json.Portable.sln from the recently added churn tests, and ran StyleCopTester with /id:SA1107 /fixall. I haven't yet tracked down the cause.

The fix 'SA1107CodeFixProvider' threw an exception after 33ms:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.CodeAnalysis.CSharp.CSharpExtensions.Kind(SyntaxNode node)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.CSharpSyntaxGenerator.GetDeclarationKind(SyntaxNode declaration)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.CSharpSyntaxGenerator.AsNodeLike(SyntaxNode existingNode, SyntaxNode newNode)
   at Microsoft.CodeAnalysis.CSharp.CodeGeneration.CSharpSyntaxGenerator.ReplaceNode(SyntaxNode root, SyntaxNode declaration, SyntaxNode newDeclaration)
   at Microsoft.CodeAnalysis.Editing.SyntaxEditor.ReplaceChange.Apply(SyntaxNode root, SyntaxGenerator generator)
   at Microsoft.CodeAnalysis.Editing.SyntaxEditor.GetChangedRoot()
   at StyleCop.Analyzers.ReadabilityRules.SA1107FixAllProvider.<FixAllInDocumentAsync>d__2.MoveNext() in J:\dev\github\sharwell\StyleCopAnalyzers\StyleCop.Analyzers\StyleCop.Analyzers.CodeFixes\ReadabilityRules\SA1107FixAllProvider.cs:line 48
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at StyleCop.Analyzers.Helpers.DocumentBasedFixAllProvider.<GetSolutionFixesAsync>d__5.MoveNext() in J:\dev\github\sharwell\StyleCopAnalyzers\StyleCop.Analyzers\StyleCop.Analyzers.CodeFixes\Helpers\DocumentBasedFixAllProvider.cs:line 107
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.CodeActions.CodeAction.<ComputeOperationsAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.CodeActions.CodeAction.<GetOperationsCoreAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.CodeActions.CodeAction.<GetOperationsAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at StyleCopTester.CodeFixEquivalenceGroup.<GetOperationsAsync>d__23.MoveNext() in J:\dev\github\sharwell\StyleCopAnalyzers\StyleCop.Analyzers\StyleCopTester\CodeFixEquivalenceGroup.cs:line 141
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at StyleCopTester.Program.<TestFixAllAsync>d__3.MoveNext() in J:\dev\github\sharwell\StyleCopAnalyzers\StyleCop.Analyzers\StyleCopTester\Program.cs:line 198
@sharwell
Copy link
Member Author

This was caused by a bug in #1983, and was corrected in 5fa8d69.

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

No branches or pull requests

1 participant