This project is read-only.


NullReferenceException on Light bulb menu for properties



In VS 14 CTP2 I created a simple ISyntaxNodeAnalyzer<SyntaxKind> for SyntaxKind.PropertyDeclaration doing nothing. It works correctly and if a CodeFix exists it is displayed. But as soon as I hover the "Supress with pragma" an exception is raised in Roslyn extension and crashes it (The two other "ignore" menu items work correctly)

I attached the activity log file.

    [ExportDiagnosticAnalyzer("BlackFox.TestAnalyzer", LanguageNames.CSharp)]
    public class TestAnalyzer : ISyntaxNodeAnalyzer<SyntaxKind>
        public const string IdSimple = "BlackFox.Test";

        public static DiagnosticDescriptor Descriptor { get; }
            = new DiagnosticDescriptor(
                "Can be converted to statement body",
                "Can be converted to statement body",
                isEnabledByDefault: true);

        public ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }
            = ImmutableArray.Create(Descriptor);

        public ImmutableArray<SyntaxKind> SyntaxKindsOfInterest { get; }
        = ImmutableArray.Create(SyntaxKind.PropertyDeclaration);

        public void AnalyzeNode(SyntaxNode node, SemanticModel semanticModel, Action<Diagnostic> addDiagnostic,
            CancellationToken cancellationToken)
            addDiagnostic(Diagnostic.Create(Descriptor, node.GetLocation()));

file attachments


manishv wrote Aug 8, 2014 at 7:48 AM

Thank you for the report. This was fixed recently in the Roslyn IDE layer and should be part of the next preview drop of Roslyn SDK.

vbfox wrote Aug 10, 2014 at 4:35 PM

Nice, thanks a lot.