dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.13k stars 4.04k forks source link

System.InvalidOperationException: Unexpected value ' at at Microsoft.CodeAnalysis.TaggedTextExtensions.ToClassificationTypeName(String taggedTextTag) #40440

Closed vsfeedback closed 3 years ago

vsfeedback commented 4 years ago

This issue has been moved from a ticket on Developer Community.


The problem happened in Microsoft.CodeAnalysis.TaggedTextExtensions.ToClassificationTypeName(String taggedTextTag) at the time I inserted a certain library assembly name on my code it has triggered a yellow banner below top menu ribbon with this error

here is the log

1992 Error Editor or Editor Extension System.InvalidOperationException: Unexpected value 'ContainerStart' of type 'System.String' at Microsoft.CodeAnalysis.TaggedTextExtensions.ToClassificationTypeName(String taggedTextTag) at Microsoft.CodeAnalysis.Editor.Shared.Extensions.ClassificationExtensions.ToClassificationSpans(IEnumerable`1 parts, ITextSnapshot textSnapshot, ClassificationTypeMap typeMap) at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Presentation.SignatureHelpClassifier.GetClassificationSpans(SnapshotSpan span) at Microsoft.VisualStudio.Text.Classification.Implementation.ClassifierTagger.<GetTags>d__5.MoveNext() at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<GetTagsForBuffer>d__47.MoveNext()

Original Comments

Visual Studio Feedback System on 12/9/2019, 02:26 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

valimaties commented 4 years ago

I have the same error, using InformationBox project from GitHub. When Intellisense opens popup, yellow banner shows which shows me a link to the error file, indicating this error:

System.InvalidOperationException: Unexpected value 'ContainerStart' of type 'System.String' at Microsoft.CodeAnalysis.TaggedTextExtensions.ToClassificationTypeName(String taggedTextTag) at Microsoft.CodeAnalysis.Editor.Shared.Extensions.ClassificationExtensions.ToClassificationSpans(IEnumerable1 parts, ITextSnapshot textSnapshot, ClassificationTypeMap typeMap) at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Presentation.SignatureHelpClassifier.GetClassificationSpans(SnapshotSpan span) at Microsoft.VisualStudio.Text.Classification.Implementation.ClassifierTagger.<GetTags>d__5.MoveNext() at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator1.d__47.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

chhornung commented 3 years ago

I just got a very similar error in V 16.8.3 (experimental instance with all third-party extensions disabled) and tracked it down to a very specific situation: It happens when entering a comma in the argument list of an attribute constructor call when the XML doc summary of that constructor contains a bullet list.

Example code to reproduce (I placed this in a new .NET Framework 4.8 C# Console App project):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp10
{
    class Program
    {
        // Place caret here and delete and re-enter the comma to trigger the error:
        //     v
        [Test(1, 2)]
        static void Main(string[] args)
        {
        }
    }

    class TestAttribute : Attribute
    {
        /// <summary>
        /// <list type="bullet">
        /// <item><description>Item 1</description></item>
        /// <item><description>Item 2</description></item>
        /// </list>
        /// </summary>
        public TestAttribute(int a, int b)
        {
        }
    }
}

Error message: InvalidOperationException: Unexpected value 'ContainerStart' of type 'System.String'

Log file attached. ActivityLog.xml.log

kzrnm commented 3 years ago

Is it the same problem as #50114 ?