.NET Framework 4.7.2 library project. Subset of original class, which reproduces problem:
SimplifyNullCheckAnalyzer throws an exception for the return statement in the above function.
Analyzer 'Roslynator.CSharp.Analysis.SimplifyNullCheckAnalyzer' 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: Synaptive.Drive.Optics.Camera.Common
SyntaxTree: C:\Users\gordon.tyler\dev\Synaptive\ModusV\Drive\Source\Optics\Camera\Common\CameraCommands.cs
SyntaxNode: default(T) == null ? (T)Convert ... [ConditionalExpressionSyntax]@[10158..10238) (210,19)-(210,99)
System.NullReferenceException: Object reference not set to an instance of an object.
at Roslynator.CSharp.Syntax.NullCheckExpressionInfo.IsNullOrDefault(ExpressionSyntax left, ExpressionSyntax right, SemanticModel semanticModel, CancellationToken cancellationToken)
at Roslynator.CSharp.Syntax.NullCheckExpressionInfo.Create(BinaryExpressionSyntax binaryExpression, SyntaxKind binaryExpressionKind, ExpressionSyntax expression1, ExpressionSyntax expression2, NullCheckStyles allowedStyles, Boolean allowMissing, SemanticModel semanticModel, CancellationToken cancellationToken)
at Roslynator.CSharp.Syntax.NullCheckExpressionInfo.CreateImpl(SyntaxNode node, SemanticModel semanticModel, NullCheckStyles allowedStyles, Boolean walkDownParentheses, Boolean allowMissing, CancellationToken cancellationToken)
at Roslynator.CSharp.Syntax.NullCheckExpressionInfo.Create(SyntaxNode node, SemanticModel semanticModel, NullCheckStyles allowedStyles, Boolean walkDownParentheses, Boolean allowMissing, CancellationToken cancellationToken)
at Roslynator.CSharp.Analysis.SimplifyNullCheckAnalyzer.AnalyzeConditionalExpression(SyntaxNodeAnalysisContext context)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__62`1.<ExecuteSyntaxNodeAction>b__62_0(ValueTuple`2 data)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info)
Product and Version Used:
Visual Studio 2022 v17.4.1
Roslynator 4.2.0
Steps to Reproduce:
.NET Framework 4.7.2 library project. Subset of original class, which reproduces problem:
SimplifyNullCheckAnalyzer throws an exception for the return statement in the above function.