You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[severity:It bothers me. A fix would be nice]
I had this issue after copy-pasting some stuff, creating a piece of (nonsense) code that caused many internal errors.
I managed to create a smaller piece of code that still reproduces the same error:
using System;
internal class Program
{
static void Main()
{
foo:
void Bar()
{
using var obj = (IDisposable)null!; // casting null to an IDisposable is for demonstration purposes
goto foo;
}
}
}
After writing that, multiple banners appear saying that Feature X is currently unavailable due to an internal error.
It seems that trying to jump to an unreachable label from a point after a using declaration causes errors with the following stacktrace:
StreamJsonRpc.RemoteInvocationException: The given key 'foo' was not present in the dictionary.
at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__151`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Threading.Tasks.ValueTask`1.get_Result()
at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.<TryInvokeAsync>d__22`1.MoveNext()
RPC server exception:
System.Collections.Generic.KeyNotFoundException: The given key 'foo' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.CodeAnalysis.CSharp.ControlFlowPass.VisitGotoStatement(BoundGotoStatement node)
at Microsoft.CodeAnalysis.CSharp.ControlFlowPass.Visit(BoundNode node)
at Microsoft.CodeAnalysis.CSharp.ControlFlowPass.VisitStatement(BoundStatement statement)
at Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2.VisitStatements(ImmutableArray`1 statements)
at Microsoft.CodeAnalysis.CSharp.ControlFlowPass.VisitBlock(BoundBlock node)
at Microsoft.CodeAnalysis.CSharp.ControlFlowPass.Visit(BoundNode node)
at Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2.Scan(Boolean& badRegion)
at Microsoft.CodeAnalysis.CSharp.ControlFlowPass.Scan(Boolean& badRegion)
at Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2.Analyze(Boolean& badRegion, Optional`1 initialState)
at Microsoft.CodeAnalysis.CSharp.ControlFlowPass.Analyze(Boolean& badRegion, DiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.ControlFlowPass.Analyze(CSharpCompilation compilation, Symbol member, BoundBlock block, DiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.<BindLocalFunctionStatement>g__runAnalysis|876_0(BoundBlock block, BindingDiagnosticBag blockDiagnostics, <>c__DisplayClass876_0&)
at Microsoft.CodeAnalysis.CSharp.Binder.BindLocalFunctionStatement(LocalFunctionStatementSyntax node, BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindStatement(StatementSyntax node, BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindLabeled(LabeledStatementSyntax node, BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindStatement(StatementSyntax node, BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindBlockParts(BlockSyntax node, BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindBlock(BlockSyntax node, BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindStatement(StatementSyntax node, BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindMethodBody(CSharpSyntaxNode declaration, BlockSyntax blockBody, ArrowExpressionClauseSyntax expressionBody, BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.Binder.BindMethodBody(CSharpSyntaxNode syntax, BindingDiagnosticBag diagnostics)
at Microsoft.CodeAnalysis.CSharp.MethodCompiler.BindMethodBody(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, Boolean includeInitializersInBody, BoundNode initializersBody, Boolean reportNullableDiagnostics, ImportChain& importChain, Boolean& originalBodyNested, Boolean& prependedDefaultValueTypeConstructorInitializer, InitialState& forSemanticModel)
at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(MethodSymbol methodSymbol, Int32 methodOrdinal, ProcessedFieldInitializers& processedInitializers, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState)
at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol containingType)
at Microsoft.CodeAnalysis.CSharp.MethodCompiler.VisitNamedType(NamedTypeSymbol symbol, TypeCompilationState arg)
at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamespace(NamespaceSymbol symbol)
at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethodBodies(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuiltOpt, Boolean emittingPdb, Boolean hasDeclarationErrors, Boolean emitMethodBodies, BindingDiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.<GetDiagnosticsForMethodBodiesInTree>g__compileMethodBodiesAndDocComments|226_0(SyntaxTree filterTree, Nullable`1 filterSpan, BindingDiagnosticBag bindingDiagnostics, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, Nullable`1 span, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForSyntaxTree(CompilationStage stage, SyntaxTree syntaxTree, Nullable`1 filterSpanWithinTree, Boolean includeEarlierStages, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDiagnostics(Nullable`1 span, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1.GetUniqueFixesAsyncInCurrentProcessAsync(Document document, TextSpan span, ImmutableArray`1 diagnosticIds, ISymbolSearchService symbolSearchService, AddImportOptions options, ImmutableArray`1 packageSources, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1.GetUniqueFixesAsync(Document document, TextSpan span, ImmutableArray`1 diagnosticIds, ISymbolSearchService symbolSearchService, AddImportOptions options, ImmutableArray`1 packageSources, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteMissingImportDiscoveryService.<>c__DisplayClass4_0.<<GetUniqueFixesAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<>c__DisplayClass9_0`1.<<RunWithSolutionAsync>g__ProcessSolutionAsync|1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Int32 workspaceVersion, Boolean updatePrimaryBranch, Func`2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.RunWithSolutionAsync[T](AssetProvider assetProvider, Checksum solutionChecksum, Int32 workspaceVersion, Boolean updatePrimaryBranch, Func`2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.RunWithSolutionAsync[T](Checksum solutionChecksum, Func`2 implementation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.RunServiceImplAsync[T](Func`2 implementation, CancellationToken cancellationToken)
Original Comments
Feedback Bot on 5/6/2024, 01:49 PM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered:
C:\Program Files\dotnet\sdk\8.0.300\Roslyn\Microsoft.CSharp.Core.targets(85,5): error : Process terminated. System.Collections.Generic.KeyNotFoundException: The given key 'foo' was not present in the dictionary. [C:\Users\dabarbet\source\repo
s\trash\CompilerCrash\CompilerCrash.csproj]
C:\Program Files\dotnet\sdk\8.0.300\Roslyn\Microsoft.CSharp.Core.targets(85,5): error : at System.Collections.Generic.Dictionary`2.get_Item(TKey key) [C:\Users\dabarbet\source\repos\trash\CompilerCrash\CompilerCrash.csproj]
C:\Program Files\dotnet\sdk\8.0.300\Roslyn\Microsoft.CSharp.Core.targets(85,5): error : at Microsoft.CodeAnalysis.CSharp.ControlFlowPass.VisitGotoStatement(BoundGotoStatement node) [C:\Users\dabarbet\source\repos\trash\CompilerCrash\Compil
erCrash.csproj]
...truncated
This issue has been moved from a ticket on Developer Community.
[severity:It bothers me. A fix would be nice]
I had this issue after copy-pasting some stuff, creating a piece of (nonsense) code that caused many internal errors.
I managed to create a smaller piece of code that still reproduces the same error:
After writing that, multiple banners appear saying that Feature X is currently unavailable due to an internal error.
![image.png](https://camo.githubusercontent.com/215a5f043405059612804d7bb1b1ee5d1ea7b9513598f02fbf7ef3b550ebbece/68747470733a2f2f616b612e6d732f64632f696d6167653f6e616d653d4266663364356135633664656134373230396233643935623132356337306366613633383530353234333533343636393533385f32303234303530352d3138343535322d696d6167652e706e67267469643d6666336435613563366465613437323039623364393562313235633730636661363338353035323433353334363639353338)
It seems that trying to jump to an unreachable label from a point after a using declaration causes errors with the following stacktrace:
Original Comments
Feedback Bot on 5/6/2024, 01:49 PM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: