Skip to content
This repository has been archived by the owner. It is now read-only.

RedundantPrivateCodeFixProvider passes null document in DocumentChangeAction.PostProcessChangesAsync #105

Open
jmarolf opened this issue Sep 10, 2015 · 2 comments
Assignees

Comments

@jmarolf
Copy link

jmarolf commented Sep 10, 2015

Customer reported a stacktrace at dotnet/roslyn#5121.

Object reference not set to an instance of an object.
   
at Microsoft.CodeAnalysis.Simplification.Simplifier.<ReduceAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   
at RefactoringEssentials.DocumentChangeAction.<PostProcessChangesAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   
at Microsoft.CodeAnalysis.CodeActions.CodeAction.<PostProcessChangesAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   
at Microsoft.CodeAnalysis.CodeActions.CodeAction.<PostProcessAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   
at Microsoft.CodeAnalysis.CodeActions.CodeAction.<GetPreviewOperationsAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   
at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.<>c__DisplayClass10_0.<<GetPreviewOperationsAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   
at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.<GetPreviewResultAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   
at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.<>c__DisplayClass17_0.<<GetPreviewAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   
at Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.<PerformFunctionAsync>d__3`1.MoveNext()

My plan is to make sure the Simplifier throws ArgumentNull exceptions so this is easier to track down, but let me know if you have other suggestions.

@Rpinski
Copy link
Member

Rpinski commented Sep 22, 2015

Hmm, I'm still wondering how this can happen. The Document instance we pass here is something we receive from Roslyn (it's an overridden method):

https://github.com/icsharpcode/RefactoringEssentials/blob/master/RefactoringEssentials/CSharp/Diagnostics/DocumentChangeAction.cs#L39

Wouldn't that mean that Roslyn has passed a null reference to us?

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

No branches or pull requests

2 participants