Was writing c# code for console application when all of a sudden this popup appeared right below the menu bar. "Show Stack Trace" link gives below information
System.NullReferenceException : Object reference not set to an instance of an object.
at Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.IsStringConcat(ISyntaxFactsService syntaxFacts,SyntaxNode expression,SemanticModel semanticModel,CancellationToken cancellationToken)
at async Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.ComputeRefactoringsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(<Unknown Parameters>)
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
@jinujoseph Can you assign to someone else.
I just got the same error in VS2017 v15.4.3 while building an Excel AddIn.
It popped up after I changed this line:
if (assemArray[j, 0] == sr.Value2 ?? "")
to this:
if (assemArray[j, 0] ?? "" == sr.Value2 ?? "")
I reverted, clicked 'enable', re-entered the change, and got the same error.
Putting in extra parenthesis before adding ?? "" avoided the crash. The resulting code is:
if ((assemArray[j, 0] ?? "") == (sr.Value2 ?? ""))
Hopefully that makes it reproducible.
Stack trace for completeness:
System.NullReferenceException : Object reference not set to an instance of an object.
at Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.IsStringConcat(ISyntaxFactsService syntaxFacts,SyntaxNode expression,SemanticModel semanticModel,CancellationToken cancellationToken)
at async Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.ComputeRefactoringsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(<Unknown Parameters>)
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
I've got the same message. Different stack trace though:
System.NullReferenceException : Object reference not set to an instance of an object.
at Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.IsStringConcat(ISyntaxFactsService syntaxFacts,SyntaxNode expression,SemanticModel semanticModel,CancellationToken cancellationToken)
at async Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.ComputeRefactoringsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(<Unknown Parameters>)
Here's another reproducer. Place the caret before "d" and press Ctrl+.
using System;
public class Class1
{
public Class1()
{
dynamic a = "b";
string c = "d" + a + "e";
}
}
also reported at link
Most helpful comment
@jinujoseph Can you assign to someone else.