Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backslach in interpolated raw string literal #59670

Closed
ufcpp opened this issue Feb 20, 2022 · 2 comments · Fixed by #59676
Closed

Backslach in interpolated raw string literal #59670

ufcpp opened this issue Feb 20, 2022 · 2 comments · Fixed by #59676
Labels
Area-IDE Bug Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented

Comments

@ufcpp
Copy link
Contributor

ufcpp commented Feb 20, 2022

Version Used:

Version 17.2.0 Preview 1.0

Steps to Reproduce:

$"""
\
"""

An internal error reported when typing \.

Another steps to reproduce:

With Microsoft.CodeAnalysis.CSharp.Workspaces Version=4.2.0-1.final

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Classification;
using Microsoft.CodeAnalysis.Text;

using var ws = new AdhocWorkspace();
var proj = ws.AddProject("A", LanguageNames.CSharp);
var doc = proj.AddDocument("A.cs", """"
$"""
\
"""
"""");

var text = await doc.GetTextAsync();
var spans = await Classifier.GetClassifiedSpansAsync(doc, TextSpan.FromBounds(0, text.Length)); // IndexOutOfRangeException thrown

Expected Behavior:

No error.

Actual Behavior:

Feature 'Semantic classification' is currently unavailable due to an internal error.

Stack Trace:

Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars.CSharpVirtualCharService.TryAddSingleCharacterEscape(ArrayBuilder`1 result, String tokenText, Int32 offset, Int32 index)
Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars.CSharpVirtualCharService.TryConvertStringToVirtualChars(SyntaxToken token, String startDelimiter, String endDelimiter, Boolean escapeBraces)
Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.VirtualChars.CSharpVirtualCharService.TryConvertToVirtualCharsWorker(SyntaxToken token)
Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars.AbstractVirtualCharService.TryConvertToVirtualChars(SyntaxToken token)
Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices.FallbackSyntaxClassifier.AddClassifications(SyntaxToken token, SemanticModel semanticModel, ClassificationOptions options, ArrayBuilder`1 result, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Classification.Classifiers.EmbeddedLanguagesClassifier.AddClassifications(SyntaxToken token, SemanticModel semanticModel, ClassificationOptions options, ArrayBuilder`1 result, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Classification.AbstractSyntaxClassificationService.Worker.ClassifyToken(SyntaxToken syntax)
Microsoft.CodeAnalysis.Classification.AbstractSyntaxClassificationService.Worker.ProcessNodes()
Microsoft.CodeAnalysis.Classification.AbstractSyntaxClassificationService.Worker.Classify(SemanticModel semanticModel, TextSpan textSpan, ArrayBuilder`1 list, Func`2 getNodeClassifiers, Func`2 getTokenClassifiers, ClassificationOptions options, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Classification.AbstractSyntaxClassificationService.<AddSemanticClassificationsAsync>d__5.MoveNext()
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 20, 2022
@CyrusNajmabadi
Copy link
Member

Hrmm. Not repro'ing this. Trying some more configurations.

@CyrusNajmabadi
Copy link
Member

Got it. Working on fix now.

@jinujoseph jinujoseph added Bug Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Feb 22, 2022
@jinujoseph jinujoseph added this to the 17.2 milestone Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants