Skip to content

Super Quick Info shows an alert with NullRef when hovering over a C# '#if' directive #397

@Bergam64

Description

@Bergam64

Hello,

I've found an annoying bug in Super Quick Info.

Repro:

  • To be on the safe side, ensure you have the same settings as I have (Codist.json).
  • Create a new C# file and replace its default contents with this:
    #if false
    // ...
    #endif
  • Hover over the #if part.
  • Boom: a 'Super Quick Info' alert appears, with this:
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Codist.QuickInfo.CSharpQuickInfo.ProcessIfToken(Context ctx) in D:\Codes\Open Source Projects\Codist\Codist\QuickInfo\CSharpQuickInfo.Token.cs:line 439
       at Codist.QuickInfo.CSharpQuickInfo.<InternalGetQuickInfoItemAsync>d__82.MoveNext() in D:\Codes\Open Source Projects\Codist\Codist\QuickInfo\CSharpQuickInfo.cs:line 149
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Codist.QuickInfo.SingletonQuickInfoSource.<InternalGetQuickInfoItemAsync>d__2.MoveNext() in D:\Codes\Open Source Projects\Codist\Codist\QuickInfo\QuickInfoFactories.cs:line 134
    

Notes:

  • Oddly enough, the bug doesn't happen 100% of the times (my guess is around 90%): sometimes, it doesn't happen and in that case, I can see a tooltip with this (which I guess is the expected behavior):
    Syntax Path:
    IfKeyword < IfDirectiveTrivia
    
  • When the bug happens, I just close the alert and I can continue working in VS. So there's no crash, but still it's boring.
  • For the record, the bug exists in both Codist 8.1.1.10764 in VS 2022 17.14.25 and Codist 8.1.1.11182 in VS 2026 Insiders [11519.219]. The above-mentioned stacktrace is exactly the same in each case).
  • No bug for other C# directive lines, like #else, #endif, #nullable enable or #pragma ....

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions