Closed Hosch250 closed 6 years ago
What's the bug?
I haven't checked yet. The code fix just has an error.
It seems that it is picking something up in the .g.i.cs
file for UWP and WPF projects. We'll have to ignore these locations in the code fixes as well as when firing analyzers (not when inspecting the code in analyzers, though). Reference #576
After further research into this, I think I found the problem's root. We only have the root for one document:
var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
This messes up the call when we try to get the type declaration node:
var node = (TypeDeclarationSyntax) root.FindNode(location.SourceSpan);
So, we just pick up a random node at that location in the document we are in. This means that rather than checking the node for members, we'll have to check the symbol for members we are interested in. Hmm, why didn't we do that in the first place?
I encountered this failure with the following class: