Roslyn: CSharpConvertConcatenationToInterpolatedStringRefactoringProvider encountered an error and has been disabled.

Created on 18 Jul 2017  路  5Comments  路  Source: dotnet/roslyn

From: https://developercommunity.visualstudio.com/content/problem/78891/csharpconvertconcatenationtointerpolatedstringrefa.html

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)
Area-IDE Bug Resolution-Fixed help wanted

Most helpful comment

@jinujoseph Can you assign to someone else.

All 5 comments

@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";
    }
}

:link: https://developercommunity.visualstudio.com/content/problem/183546/csharpconvertconcatenationtointerpolatedstringrefa-2.html

also reported at link

Was this page helpful?
0 / 5 - 0 ratings