When pressing Ctrl+. over the WTG3013 error produced by the following function:
public override AttributeCollection GetAttributes()
{
var attributes = base.GetAttributes()?
.Cast<Attribute>()
.Concat(new[] { new ResourceStringKeyOverrideAttribute(dataType.Name) })
.ToArray();
return new AttributeCollection(attributes);
}
The LinqEnumerableCodeFixProvider crashes with the following stack trace:
System.NullReferenceException : Object reference not set to an instance of an object.
at Microsoft.CodeAnalysis.CSharp.SyntaxFactory.FindConditionalAccessNodeForBinding(CSharpSyntaxNode node)
at Microsoft.CodeAnalysis.CSharp.Binder.GetReceiverForConditionalBinding(ExpressionSyntax binding,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindMemberBindingExpression(MemberBindingExpressionSyntax node,Boolean invoked,Boolean indexed,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal(ExpressionSyntax node,BindingDiagnosticBag diagnostics,Boolean invoked,Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression(ExpressionSyntax node,BindingDiagnosticBag diagnostics,Boolean invoked,Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindInvocationExpression(InvocationExpressionSyntax node,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal(ExpressionSyntax node,BindingDiagnosticBag diagnostics,Boolean invoked,Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression(ExpressionSyntax node,BindingDiagnosticBag diagnostics,Boolean invoked,Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindParenthesizedExpression(ExpressionSyntax innerExpression,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal(ExpressionSyntax node,BindingDiagnosticBag diagnostics,Boolean invoked,Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression(ExpressionSyntax node,BindingDiagnosticBag diagnostics,Boolean invoked,Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindLeftOfPotentialColorColorMemberAccess(ExpressionSyntax left,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindMemberAccess(MemberAccessExpressionSyntax node,Boolean invoked,Boolean indexed,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindInvocationExpression(InvocationExpressionSyntax node,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal(ExpressionSyntax node,BindingDiagnosticBag diagnostics,Boolean invoked,Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression(ExpressionSyntax node,BindingDiagnosticBag diagnostics,Boolean invoked,Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindConditionalAccessExpression(ConditionalAccessExpressionSyntax node,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpressionInternal(ExpressionSyntax node,BindingDiagnosticBag diagnostics,Boolean invoked,Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindExpression(ExpressionSyntax node,BindingDiagnosticBag diagnostics,Boolean invoked,Boolean indexed)
at Microsoft.CodeAnalysis.CSharp.Binder.BindInferredVariableInitializer(BindingDiagnosticBag diagnostics,ExpressionSyntax initializer,BindValueKind valueKind,CSharpSyntaxNode errorSyntax)
at Microsoft.CodeAnalysis.CSharp.Binder.BindVariableDeclaration(SourceLocalSymbol localSymbol,LocalDeclarationKind kind,Boolean isVar,VariableDeclaratorSyntax declarator,TypeSyntax typeSyntax,TypeWithAnnotations declTypeOpt,AliasSymbol aliasOpt,BindingDiagnosticBag diagnostics,Boolean includeBoundType,CSharpSyntaxNode associatedSyntaxNode)
at Microsoft.CodeAnalysis.CSharp.Binder.BindDeclarationStatementParts(LocalDeclarationStatementSyntax node,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindLocalDeclarationStatement(LocalDeclarationStatementSyntax node,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindStatement(StatementSyntax node,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindBlockParts(BlockSyntax node,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindBlock(BlockSyntax node,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindStatement(StatementSyntax node,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindMethodBody(CSharpSyntaxNode declaration,BlockSyntax blockBody,ArrowExpressionClauseSyntax expressionBody,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindMethodBody(CSharpSyntaxNode syntax,BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.MemberSemanticModel.EnsureNullabilityAnalysisPerformedIfNecessary()
at Microsoft.CodeAnalysis.CSharp.MethodBodySemanticModel.TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel,Int32 position,StatementSyntax statement,PublicSemanticModel& speculativeModel)
at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel,Int32 position,StatementSyntax statement,PublicSemanticModel& speculativeModel)
at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.TryGetSpeculativeSemanticModel(Int32 position,StatementSyntax statement,SemanticModel& speculativeModel)
at Microsoft.CodeAnalysis.CSharp.Utilities.SpeculationAnalyzer.CreateSpeculativeSemanticModelForNode(SyntaxNode nodeToSpeculate,SemanticModel semanticModel,Int32 position,Boolean isInNamespaceOrTypeContext)
at async Microsoft.CodeAnalysis.Simplification.AbstractSimplificationService`3.<>c__DisplayClass15_1.<ReduceAsync>b__0[TExpressionSyntax,TStatementSyntax,TCrefSyntax](<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Simplification.AbstractSimplificationService`3.ReduceAsync[TExpressionSyntax,TStatementSyntax,TCrefSyntax](<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Simplification.AbstractSimplificationService`3.ReduceCoreAsync[TExpressionSyntax,TStatementSyntax,TCrefSyntax](<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Simplification.AbstractSimplificationService`3.ReduceAsync[TExpressionSyntax,TStatementSyntax,TCrefSyntax](<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Simplification.Simplifier.ReduceAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.CleanupDocumentAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessChangesAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessChangesAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetPreviewOperationsAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.GetPreviewResultAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionWithNestedFlavors.PreviewChangesSuggestedAction.CreateAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionWithNestedFlavors.GetPreviewChangesFlavorAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionWithNestedFlavors.CreateAllFlavorsAsync(<Unknown Parameters>)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameters>)
Interestingly, we don't seem to be in that stack trace at all.
When pressing Ctrl+. over the WTG3013 error produced by the following function:
The LinqEnumerableCodeFixProvider crashes with the following stack trace:
Interestingly, we don't seem to be in that stack trace at all.