olsh/resharper-structured-logging

Exception in CompileTimeConstantTemplateAnalyzer

krasnotsvetov opened this issue · 3 comments

Hello,
There is NPE in analyzer, could you please take a look?

Analyzer 'ReSharper.Structured.Logging.Analyzer.CompileTimeConstantTemplateAnalyzer' threw the following exception: Object reference not set to an instance of an object.

at ReSharper.Structured.Logging.Analyzer.CompileTimeConstantTemplateAnalyzer.Run(IInvocationExpression element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) in C:\projects\resharper-structured-logging\src\ReSharper.Structured.Logging\Analyzer\CompileTimeConstantTemplateAnalyzer.cs:line 24
at JetBrains.ReSharper.Feature.Services.Daemon.ElementProblemAnalyzerRegistrar.ElementAnalyzerDispatcher.Run(ITreeNode element, IHighlightingConsumer consumer)

olsh commented

Hi @krasnotsvetov

Thank you for letting me know. 👍🏻

Which version of the extension do you use?
Do you have code that reproduces the issue?

These exceptions are reported to JetBrains issue tracker via the IDE error reporting facility.

Unfortunately, we have no code samples (unless your plugin logs them).

The last time it happened, the plugin version was reported by the user as Structured Logging (2021.3.0.175-eap04).

Probably we could just add a null check against templateArgument.Value here?

And, if this is a bogus issue, then log the templateArgument and maybe element itself somewhere after the failed check.

(but please don't embed the user code into the exception message itself)

olsh commented

Hi @ForNeVeR

Sadly, I didn't manage to reproduce the issue. So I just added the null checking as you suggested.

Thanks.