Please provide
- Operating system: Windows 10
- Visual Studio version: 17.12.3
- SonarLint plugin version: 8.9.0.11507
- Programming language you’re coding in: c#
- Is connected mode used:No
- Connected to SonarCloud or SonarQube (and which version):
And a thorough description of the problem / question:
I got some analyzer exceptions when I had some invalid c# code, this was the offending code (new ASP.NET Core 9 Aspire project with space in the projectname. That seems not to be supported that well.)
var builder = DistributedApplication.CreateBuilder(args);
builder.AddProject<Projects.Data Protection Demo>("data protection demo");
builder.AddProject<Projects.Data Protection Demo2>("data protection demo2");
builder.Build().Run();
Severity Code Description Project File Line Suppression State Details
Warning (active) AD0001 Analyzer 'SonarAnalyzer.Rules.CSharp.UseCharOverloadOfStringMethods' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
Exception occurred with following context:
Compilation: Data Protection Demo2
System.NullReferenceException: Object reference not set to an instance of an object.
at SonarAnalyzer.Rules.UseCharOverloadOfStringMethodsBase`2.CompilationTargetsValidNetVersion(Compilation compilation)
at SonarAnalyzer.Rules.UseCharOverloadOfStringMethodsBase`2.<Initialize>b__5_0(SonarCompilationStartAnalysisContext start)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken)
-----
Suppress the following diagnostics to disable this analyzer: S6610 Z:\GitHubTN\Talks\Conference Talks\Swetugg 2025\Demo - Data Protection\Data Protection Demo\Data Protection Demo2\Data Protection Demo2.csproj ({4C50C5D3-C4BD-4637-869C-0F15BFD81A27}) Z:\GitHubTN\Talks\Conference Talks\Swetugg 2025\Demo - Data Protection\Data Protection Demo\Data Protection Demo2\Data Protection Demo2.csproj 1
Severity Code Description Project File Line Suppression State Details
Warning (active) AD0001 Analyzer 'SonarAnalyzer.Rules.CSharp.BooleanLiteralUnnecessary' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
Exception occurred with following context:
Compilation: Data Protection Demo2
System.NullReferenceException: Object reference not set to an instance of an object.
at SonarAnalyzer.Rules.BooleanLiteralUnnecessaryBase`1.<Initialize>b__9_0(SonarCompilationStartAnalysisContext x)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken)
-----
Suppress the following diagnostics to disable this analyzer: S1125 Z:\GitHubTN\Talks\Conference Talks\Swetugg 2025\Demo - Data Protection\Data Protection Demo\Data Protection Demo2\Data Protection Demo2.csproj ({4C50C5D3-C4BD-4637-869C-0F15BFD81A27}) Z:\GitHubTN\Talks\Conference Talks\Swetugg 2025\Demo - Data Protection\Data Protection Demo\Data Protection Demo2\Data Protection Demo2.csproj 1
Severity Code Description Project File Line Suppression State Details
Warning (active) AD0001 Analyzer 'SonarAnalyzer.Rules.CSharp.UseUnixEpoch' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
Exception occurred with following context:
Compilation: Data Protection Demo2
System.NullReferenceException: Object reference not set to an instance of an object.
at SonarAnalyzer.Rules.UseUnixEpochBase`3.IsUnixEpochSupported(Compilation compilation)
at SonarAnalyzer.Rules.UseUnixEpochBase`3.<Initialize>b__10_0(SonarCompilationStartAnalysisContext c)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken)
-----
Suppress the following diagnostics to disable this analyzer: S6588 Z:\GitHubTN\Talks\Conference Talks\Swetugg 2025\Demo - Data Protection\Data Protection Demo\Data Protection Demo2\Data Protection Demo2.csproj ({4C50C5D3-C4BD-4637-869C-0F15BFD81A27}) Z:\GitHubTN\Talks\Conference Talks\Swetugg 2025\Demo - Data Protection\Data Protection Demo\Data Protection Demo2\Data Protection Demo2.csproj 1