Suchiman / SerilogAnalyzer

Roslyn-based analysis for code using the Serilog logging library. Checks for common mistakes and usage problems.
Apache License 2.0
309 stars 29 forks source link

Analyzer threw an exception #48

Open tndata opened 5 years ago

tndata commented 5 years ago

Just go this exception when I build my application.

Severity    Code    Description Project File    Line    Suppression State   Detail Description
Warning AD0001  Analyzer 'SerilogAnalyzer.SerilogAnalyzerAnalyzer' threw an exception of type 'System.ArgumentOutOfRangeException' with message 'Specified argument was out of the range of valid values.
Parameter name: length'.    Infrastructure      1   Active  Analyzer 'SerilogAnalyzer.SerilogAnalyzerAnalyzer' threw the following exception:
'Exception occurred with following context:
Compilation: Infrastructure
SyntaxTree: Z:\Github\EdumentTraining\Infrastructure\Logging\Logging.cs
SyntaxNode: ExecutionLog.Fatal("{exception.Message); ... [InvocationExpressionSyntax]@[2323..2365) (62,16)-(63,0)

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: length
   at Microsoft.CodeAnalysis.Text.TextSpan..ctor(Int32 start, Int32 length)
   at SerilogAnalyzer.SerilogAnalyzerAnalyzer.ReportDiagnostic(SyntaxNodeAnalysisContext& context, TextSpan& literalSpan, String stringText, Boolean exactPositions, DiagnosticDescriptor rule, MessageTemplateDiagnostic diagnostic)
   at SerilogAnalyzer.SerilogAnalyzerAnalyzer.AnalyzeSymbol(SyntaxNodeAnalysisContext context)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__50`1.<ExecuteSyntaxNodeAction>b__50_0(ValueTuple`2 data)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info)
-----
'.

Anything I can do to help you figure out this bug?

Suchiman commented 5 years ago

Do you have a sample that reproduces this issue? The snippet the exception has captured ExecutionLog.Fatal("{exception.Message); does not reproduce it for me.

tndata commented 5 years ago

Sorry, I am no longer able to reproduce it :-(