dotnet/roslyn

VS crashes on some methods when colling the intellicense.

Open

#23,516 创建于 2017年12月1日

在 GitHub 查看
 (11 评论) (0 反应) (0 负责人)C# (20,414 star) (4,257 fork)batch import
Area-CompilersBugDeveloper CommunityTenet-Reliabilityhelp wanted

描述

After calling the intellicens by the mouse - VS crashes.

The assembly with the problematic method came from Nuget.

Unfortunately this is all I can say. the attached video ends immediatyly after method highlighting as VS is crashed,

CLR: Managed code called FailFast, saying "System.InvalidCastException: Specified cast is not valid.
   at Roslyn.Utilities.EnumUtilities.ConvertEnumUnderlyingTypeToUInt64(Object value, SpecialType specialType)
   at Microsoft.CodeAnalysis.SymbolDisplay.AbstractSymbolDisplayVisitor.AddFlagsEnumConstantValue(INamedTypeSymbol enumType, Object constantValue, ArrayBuilder`1 allFieldsAndValues, ArrayBuilder`1 usedFieldsAndValues, Boolean preferNumericValueOrExpandedFlags)
   at Microsoft.CodeAnalysis.SymbolDisplay.AbstractSymbolDisplayVisitor.AddFlagsEnumConstantValue(INamedTypeSymbol enumType, Object constantValue, Boolean preferNumericValueOrExpandedFlags)
   at Microsoft.CodeAnalysis.SymbolDisplay.AbstractSymbolDisplayVisitor.AddEnumConstantValue(INamedTypeSymbol enumType, Object constantValue, Boolean preferNumericValueOrExpandedFlags)
   at Microsoft.CodeAnalysis.SymbolDisplay.AbstractSymbolDisplayVisitor.AddNonNullConstantValue(ITypeSymbol type, Object constantValue, Boolean preferNumericValueOrExpandedFlagsForEnum)
   at Microsoft.CodeAnalysis.CSharp.SymbolDisplayVisitor.AddConstantValue(ITypeSymbol type, Object constantValue, Boolean preferNumericValueOrExpandedFlagsForEnum)
   at Microsoft.CodeAnalysis.CSharp.SymbolDisplayVisitor.VisitParameter(IParameterSymbol symbol)
   at Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol.Accept(SymbolVisitor visitor)
   at Microsoft.CodeAnalysis.CSharp.SymbolDisplayVisitor.AddParametersIfRequired(Boolean hasThisParameter, Boolean isVarargs, ImmutableArray`1 parameters)
   at Microsoft.CodeAnalysis.CSharp.SymbolDisplayVisitor.AddParameters(IMethodSymbol symbol)
   at Microsoft.CodeAnalysis.CSharp.SymbolDisplayVisitor.VisitMethod(IMethodSymbol symbol)
   at Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol.Accept(SymbolVisitor visitor)
   at Microsoft.CodeAnalysis.CSharp.SymbolDisplay.ToDisplayParts(ISymbol symbol, SemanticModel semanticModelOpt, Int32 positionOpt, SymbolDisplayFormat format, Boolean minimal)
   at Microsoft.CodeAnalysis.CSharp.SymbolDisplay.ToMinimalDisplayParts(ISymbol symbol, SemanticModel semanticModel, Int32 position, SymbolDisplayFormat format)
   at Microsoft.CodeAnalysis.CSharp.Symbol.Microsoft.CodeAnalysis.ISymbol.ToMinimalDisplayParts(SemanticModel semanticModel, Int32 position, SymbolDisplayFormat format)
   at Microsoft.CodeAnalysis.Editor.CSharp.LanguageServices.CSharpSymbolDisplayService.ToMinimalDisplayParts(SemanticModel semanticModel, Int32 position, ISymbol symbol, SymbolDisplayFormat format)
   at Microsoft.CodeAnalysis.LanguageServices.AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.ToMinimalDisplayParts(ISymbol symbol, SymbolDisplayFormat format)
   at Microsoft.CodeAnalysis.LanguageServices.AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.AddDescriptionForMethod(IMethodSymbol method)
   at Microsoft.CodeAnalysis.LanguageServices.AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.<AddDescriptionPartAsync>d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.LanguageServices.AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.<AddPartsAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.LanguageServices.AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.<BuildDescriptionSectionsAsync>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.LanguageServices.AbstractSymbolDisplayService.<ToDescriptionGroupsAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo.AbstractSemanticQuickInfoProvider.<CreateContentAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo.AbstractSemanticQuickInfoProvider.<BuildContentAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo.AbstractQuickInfoProvider.<GetQuickInfoItemAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo.AbstractQuickInfoProvider.<GetItemAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo.Controller.<ComputeModelInBackgroundAsync>d__9.MoveNext()
eax=00000000 ebx=ffffff00 ecx=00000004 edx=00000000 esi=776f9440 edi=776f9440
eip=77971fdc esp=2817cf2c ebp=2817cf60 iopl=0         nv up ei pl nz na po nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000202
ntdll!NtTerminateProcess+0xc:
77971fdc c20800          ret     8
0:069&gt; gn
       ^ No runnable debuggees error in 'gn'
0:069&gt; g
       ^ No runnable debuggees error in 'g'
0:069&gt; g
       ^ No runnable debuggees error in 'g'
0:069&gt; g
       ^ No runnable debuggees error in 'g'

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/157548/vs-crashes-on-some-methods-when-colling-the-intell.html VSTS ticketId: 530799 These are the original issue comments:

Dmytro Lisovyk on ‎11‎/‎29‎/‎2017, 05:43 AM (2 days ago): The same problem on my PC!

Sam Harwell [MSFT] on ‎11‎/‎30‎/‎2017, 08:37 AM (24 hours ago): Thank you for your feedback! For us to investigate this further, could you please provide a sample project to reproduce this issue. We look forward to hearing from you!Hi Dmytro,I didn't see any obvious bug in the code to make this happen. Before I spend a bunch of time testing things semi-randomly, I was hoping you could help me out with the following:The name of the NuGet package where the problem appearsA sample source code file showing the use of this NuGet package, with a comment pointing out the line where I can hover (quick info) to cause the crashThank you,Sam Harwell

Dmytro Oleksandrovych Baranovskyi on ‎12‎/‎1‎/‎2017, 02:01 AM (6 hours ago): Unfortunately, this is the production code, so I cannot share it.All I can say that this an extension method with a long generic signature which is defined in the referenced assembly. Nuget is not required, as we already tested. I see that the problem is in roslyn. If you provide me the code sample how to run (AddDescriptionForMethod(IMethodSymbol method)) for the extension method in the referenced library. I ll debug the roslyn and send you the info what is going on.

Dmytro Oleksandrovych Baranovskyi on ‎12‎/‎1‎/‎2017, 02:09 AM (6 hours ago): So, let's assume that we'got next:Assembly A1 with type T1Assembly B1 with static class which contains the class C which implements some extension method for T1Executable E with references the A1, B1. T1 t = new T1()t.MyExtensionMethodWhichCrashesVS(); // :)So, how to run the Roslyn on that one?

These are the original issue solutions: (no solutions)

贡献者指南