Closed Unknown6656 closed 2 years ago
Addendum: This error only occurs with this specific project/solution. I do not get the error with other .csproj
/.sln
files.
This suggests that the error is not residing in an external compiler process or "server", as the error message might suggest.
Feels like the server compiler crashed. Could you enable crash dumps (see instructions) and see if the repro produces one? If yes, opening the crash dump in Visual Studio, then debugging in managed mode should let you see the stack trace of the crash. That would be useful information.
@jcouv Thanks for the instructions. I tried to debug the memory dump file, however, I was unable to load all the symbols and therefore only had the raw assembly code, the heap dump, and an enumeration of all running tasks/threads. Due to my lack of knowledge of the roslyn codebase, I was unable to dig further into the problem.
Could you possibly give me a few pointers?
If you or someone else wishes to take a look at the memory dump, it is available here: http://unknown6656.com/csc.exe.21680.dmp
@Unknown6656 When you debug the dump file, I assume you'll get a popup indicating that an exception happened. Can you copy the details from that exception (especially the stack trace)? Alternatively, I assume the active thread will be the interesting one, so if you open "Call Stack" window you could select the entire stack for the active thread and copy/paste it here. Thanks
@Unknown6656 Also, if you feel comfortable sharing the dump file with us, here are some instructions for doing that (you can attach the dump file when giving VS feedback):
@jcouv: I uploaded the dump file to my web server (see: http://unknown6656.com/csc.exe.21680.dmp), however, I can also upload it via the VS feedback system if you want to.
You are right in assuming that I get the exception popup. This is the stack trace as shown in the exception dialog:
at Microsoft.CodeAnalysis.CSharp.PlainUnboundLambdaState.ParameterName(Int32 index)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.<>c__DisplayClass253_0.<ReportNullabilityMismatchWithTargetDelegate>g__reportBadDelegateParameter|1(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameterSymbol, Boolean topLevel, Location location)
at Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol.CheckValidNullableMethodOverride[TArg](CSharpCompilation compilation, MethodSymbol baseMethod, MethodSymbol overrideMethod, BindingDiagnosticBag diagnostics, ReportMismatchInReturnType`1 reportMismatchInReturnType, ReportMismatchInParameterType`1 reportMismatchInParameterType, TArg extraArgument, Boolean invokedAsExtensionMethod)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.ReportNullabilityMismatchWithTargetDelegate(Location location, NamedTypeSymbol delegateType, BoundLambda lambda)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitConversion(BoundConversion conversionOpt, BoundExpression conversionOperand, Conversion conversion, TypeWithAnnotations targetTypeWithNullability, TypeWithState operandType, Boolean checkConversion, Boolean fromExplicitCast, Boolean useLegacyWarnings, AssignmentKind assignmentKind, ParameterSymbol parameterOpt, Boolean reportTopLevelWarnings, Boolean reportRemainingWarnings, Boolean extensionMethodThisArgument, Optional`1 stateForLambda, Boolean trackMembers, Location diagnosticLocationOpt, ArrayBuilder`1 previousArgumentConversionResults)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitConversion(BoundConversion node)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitExpressionWithoutStackGuard(BoundExpression node)
at Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.VisitExpressionWithStackGuard(Int32& recursionDepth, BoundExpression node)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitEventAssignmentOperator(BoundEventAssignmentOperator node)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitExpressionWithoutStackGuard(BoundExpression node)
at Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.VisitExpressionWithStackGuard(BoundExpression node)
at Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.VisitExpressionWithStackGuard(Int32& recursionDepth, BoundExpression node)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitRvalue(BoundExpression node, Boolean isKnownToBeAnLvalue)
at Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2.VisitExpressionStatement(BoundExpressionStatement node)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitStatementsWithLocalFunctions(BoundBlock block)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitBlock(BoundBlock node)
at Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2.VisitWithStackGuard(BoundNode node)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.Visit(BoundNode node)
at Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2.VisitMethodBodies(BoundBlock blockBody, BoundBlock expressionBody)
at Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2.VisitConstructorMethodBody(BoundConstructorMethodBody node)
at Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2.VisitWithStackGuard(BoundNode node)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.Visit(BoundNode node)
at Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2.Scan(Boolean& badRegion)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.Scan(Boolean& badRegion)
at Microsoft.CodeAnalysis.CSharp.AbstractFlowPass`2.Analyze(Boolean& badRegion, Optional`1 initialState)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.Analyze(NullableWalker walker, Symbol symbol, DiagnosticBag diagnostics, Optional`1 initialState, Builder snapshotBuilderOpt, Boolean requiresAnalysis)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.Analyze(CSharpCompilation compilation, Symbol symbol, BoundNode node, Binder binder, Conversions conversions, DiagnosticBag diagnostics, Boolean useConstructorExitWarnings, Boolean useDelegateInvokeParameterTypes, Boolean useDelegateInvokeReturnType, MethodSymbol delegateInvokeMethodOpt, VariableState initialState, Builder analyzedNullabilityMapOpt, Builder snapshotBuilderOpt, ArrayBuilder`1 returnTypesOpt, Boolean getFinalNullableState, VariableState& finalNullableState, Boolean requiresAnalysis)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.AnalyzeWithSemanticInfo(CSharpCompilation compilation, Symbol symbol, BoundNode node, Binder binder, VariableState initialState, DiagnosticBag diagnostics, Boolean createSnapshots, Boolean requiresAnalysis)
at Microsoft.CodeAnalysis.CSharp.NullableWalker.AnalyzeAndRewrite(CSharpCompilation compilation, Symbol symbol, BoundNode node, Binder binder, VariableState initialState, DiagnosticBag diagnostics, Boolean createSnapshots, SnapshotManager& snapshotManager, ImmutableDictionary`2& remappedSymbols)
at Microsoft.CodeAnalysis.CSharp.MethodCompiler.BindMethodBody(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, VariableState nullableInitialState, Boolean reportNullableDiagnostics, Boolean includesFieldInitializers, ImportChain& importChain, Boolean& originalBodyNested, 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.<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0()
When inspecting the current thread, I get the following stack trace (this trace includes the argument values of each function call):
[Managed to Native Transition]
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedTypeAsync.AnonymousMethod__0()
[Native to Managed Transition]
[Managed to Native Transition]
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.PlainUnboundLambdaState.ParameterName(int index = 1)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.ReportNullabilityMismatchWithTargetDelegate.__reportBadDelegateParameter|1(Microsoft.CodeAnalysis.CSharp.BindingDiagnosticBag bag, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol sourceInvokeMethod, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol targetInvokeMethod, Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol parameterSymbol, bool topLevel, Microsoft.CodeAnalysis.Location location)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol.CheckValidNullableMethodOverride<Microsoft.CodeAnalysis.Location>(Microsoft.CodeAnalysis.CSharp.CSharpCompilation compilation, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol baseMethod = The runtime is unable to evaluate this expression., Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol overrideMethod = The runtime is unable to evaluate this expression., Microsoft.CodeAnalysis.CSharp.BindingDiagnosticBag diagnostics, Microsoft.CodeAnalysis.CSharp.Symbols.ReportMismatchInReturnType<Microsoft.CodeAnalysis.Location> reportMismatchInReturnType, Microsoft.CodeAnalysis.CSharp.Symbols.ReportMismatchInParameterType<Microsoft.CodeAnalysis.Location> reportMismatchInParameterType, Microsoft.CodeAnalysis.Location extraArgument, bool invokedAsExtensionMethod)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.ReportNullabilityMismatchWithTargetDelegate(Microsoft.CodeAnalysis.Location location = SourceLocation(L:\Projects.VisualStudio\Unknown6656.Core\Unknown6656.Core\Controls\Console\Controls.cs@680:35)"delegate { RequestRender(); }", Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol delegateType, Microsoft.CodeAnalysis.CSharp.BoundLambda lambda)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitConversion(Microsoft.CodeAnalysis.CSharp.BoundConversion conversionOpt = BoundConversion delegate { RequestRender(); }, Microsoft.CodeAnalysis.CSharp.BoundExpression conversionOperand, Microsoft.CodeAnalysis.CSharp.Conversion conversion, Microsoft.CodeAnalysis.CSharp.Symbols.TypeWithAnnotations targetTypeWithNullability = Evaluation of method Microsoft.CodeAnalysis.CSharp.Symbols.TypeWithAnnotations.GetDebuggerDisplay requires information which is not present in the minidump you are debugging. If you are debugging a minidump without heap, you may be able to fix this problem by collecting a new minidump with heap and evaluating the expression again., Microsoft.CodeAnalysis.CSharp.Symbols.TypeWithState operandType, bool checkConversion, bool fromExplicitCast, bool useLegacyWarnings, Microsoft.CodeAnalysis.CSharp.NullableWalker.AssignmentKind assignmentKind, Microsoft.CodeAnalysis.CSharp.Symbols.ParameterSymbol parameterOpt, bool reportTopLevelWarnings, bool reportRemainingWarnings, bool extensionMethodThisArgument, Microsoft.CodeAnalysis.Optional<Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalState> stateForLambda, bool trackMembers, Microsoft.CodeAnalysis.Location diagnosticLocationOpt, Microsoft.CodeAnalysis.PooledObjects.ArrayBuilder<Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitResult> previousArgumentConversionResults)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitConversion(Microsoft.CodeAnalysis.CSharp.BoundConversion node = BoundConversion delegate { RequestRender(); })
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitExpressionWithoutStackGuard(Microsoft.CodeAnalysis.CSharp.BoundExpression node = BoundConversion delegate { RequestRender(); })
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.VisitExpressionWithStackGuard(ref int recursionDepth, Microsoft.CodeAnalysis.CSharp.BoundExpression node)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitEventAssignmentOperator(Microsoft.CodeAnalysis.CSharp.BoundEventAssignmentOperator node = BoundEventAssignmentOperator PickedColorChanged += delegate { RequestRender(); })
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitExpressionWithoutStackGuard(Microsoft.CodeAnalysis.CSharp.BoundExpression node = BoundEventAssignmentOperator PickedColorChanged += delegate { RequestRender(); })
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.VisitExpressionWithStackGuard(Microsoft.CodeAnalysis.CSharp.BoundExpression node = BoundEventAssignmentOperator PickedColorChanged += delegate { RequestRender(); })
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.VisitExpressionWithStackGuard(ref int recursionDepth = 2, Microsoft.CodeAnalysis.CSharp.BoundExpression node)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitRvalue(Microsoft.CodeAnalysis.CSharp.BoundExpression node = BoundEventAssignmentOperator PickedColorChanged += delegate { RequestRender(); }, bool isKnownToBeAnLvalue)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.AbstractFlowPass<Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalState, System.__Canon>.VisitExpressionStatement(Microsoft.CodeAnalysis.CSharp.BoundExpressionStatement node)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitStatementsWithLocalFunctions(Microsoft.CodeAnalysis.CSharp.BoundBlock block)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.VisitBlock(Microsoft.CodeAnalysis.CSharp.BoundBlock node)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.AbstractFlowPass<Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalState, System.__Canon>.VisitWithStackGuard(Microsoft.CodeAnalysis.CSharp.BoundNode node)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.Visit(Microsoft.CodeAnalysis.CSharp.BoundNode node = BoundBlock {
Size = new Size(18, 6);
MaximumSize = Size;
MinimumSize = Size;
CanChangeText = false;
BorderStyle = BorderStyle.Rounded;
FocusedStyle = FocusedStyle.RenderAsNormal;
PickedColorChanged += delegate { RequestRender(); };
SelectedHexIndexChanged += delegate { RequestRender(); };
SelectedChannelIndexChanged += delegate { RequestRender(); };
KeyPress += ColorPicker_KeyPress;
})
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.AbstractFlowPass<Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalState, System.__Canon>.VisitMethodBodies(Microsoft.CodeAnalysis.CSharp.BoundBlock blockBody, Microsoft.CodeAnalysis.CSharp.BoundBlock expressionBody)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.AbstractFlowPass<Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalState, System.__Canon>.VisitConstructorMethodBody(Microsoft.CodeAnalysis.CSharp.BoundConstructorMethodBody node)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.AbstractFlowPass<Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalState, System.__Canon>.VisitWithStackGuard(Microsoft.CodeAnalysis.CSharp.BoundNode node)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.Visit(Microsoft.CodeAnalysis.CSharp.BoundNode node = BoundConstructorMethodBody public ColorPicker(ControlHost host)
: base(host)
{
Size = new Size(18, 6);
MaximumSize = Size;
MinimumSize = Size;
CanChangeText = false;
BorderStyle = BorderStyle.Rounded;
FocusedStyle = FocusedStyle.RenderAsNormal;
PickedColorChanged += delegate { RequestRender(); };
SelectedHexIndexChanged += delegate { RequestRender(); };
SelectedChannelIndexChanged += delegate { RequestRender(); };
KeyPress += ColorPicker_KeyPress;
})
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.AbstractFlowPass<Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalState, Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalFunctionState>.Scan(ref bool badRegion = false)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.Scan(ref bool badRegion)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.AbstractFlowPass<Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalState, Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalFunctionState>.Analyze(ref bool badRegion = false, Microsoft.CodeAnalysis.Optional<Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalState> initialState)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.Analyze(Microsoft.CodeAnalysis.CSharp.NullableWalker walker = {NullableWalker this!this._PickedColor!this._selectedchannelindex!this._selectedhexindex!this.UseDefaultTextRenderer!this.SelectedChannelIndexChanged?this.SelectedHexIndexChanged?this.PickedColorChanged?Red!host!!this.Size!this.MaximumSize!this.MinimumSize!this.CanChangeText!this.BorderStyle!Rounded!this.FocusedStyle!RenderAsNormal!}, Microsoft.CodeAnalysis.CSharp.Symbol symbol = The runtime is unable to evaluate this expression., Microsoft.CodeAnalysis.DiagnosticBag diagnostics = Count = 0, Microsoft.CodeAnalysis.Optional<Microsoft.CodeAnalysis.CSharp.NullableWalker.LocalState> initialState, Microsoft.CodeAnalysis.CSharp.NullableWalker.SnapshotManager.Builder snapshotBuilderOpt = {Microsoft.CodeAnalysis.CSharp.NullableWalker.SnapshotManager.Builder}, bool requiresAnalysis = true)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.Analyze(Microsoft.CodeAnalysis.CSharp.CSharpCompilation compilation, Microsoft.CodeAnalysis.CSharp.Symbol symbol, Microsoft.CodeAnalysis.CSharp.BoundNode node, Microsoft.CodeAnalysis.CSharp.Binder binder, Microsoft.CodeAnalysis.CSharp.Conversions conversions, Microsoft.CodeAnalysis.DiagnosticBag diagnostics, bool useConstructorExitWarnings, bool useDelegateInvokeParameterTypes, bool useDelegateInvokeReturnType, Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol delegateInvokeMethodOpt, Microsoft.CodeAnalysis.CSharp.NullableWalker.VariableState initialState, System.Collections.Immutable.ImmutableDictionary<Microsoft.CodeAnalysis.CSharp.BoundExpression, (Microsoft.CodeAnalysis.NullabilityInfo, Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol)>.Builder analyzedNullabilityMapOpt, Microsoft.CodeAnalysis.CSharp.NullableWalker.SnapshotManager.Builder snapshotBuilderOpt, Microsoft.CodeAnalysis.PooledObjects.ArrayBuilder<(Microsoft.CodeAnalysis.CSharp.BoundReturnStatement, Microsoft.CodeAnalysis.CSharp.Symbols.TypeWithAnnotations)> returnTypesOpt, bool getFinalNullableState = false, out Microsoft.CodeAnalysis.CSharp.NullableWalker.VariableState finalNullableState = null, bool requiresAnalysis)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.AnalyzeWithSemanticInfo(Microsoft.CodeAnalysis.CSharp.CSharpCompilation compilation, Microsoft.CodeAnalysis.CSharp.Symbol symbol, Microsoft.CodeAnalysis.CSharp.BoundNode node, Microsoft.CodeAnalysis.CSharp.Binder binder, Microsoft.CodeAnalysis.CSharp.NullableWalker.VariableState initialState, Microsoft.CodeAnalysis.DiagnosticBag diagnostics, bool createSnapshots, bool requiresAnalysis)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.NullableWalker.AnalyzeAndRewrite(Microsoft.CodeAnalysis.CSharp.CSharpCompilation compilation, Microsoft.CodeAnalysis.CSharp.Symbol symbol, Microsoft.CodeAnalysis.CSharp.BoundNode node = BoundConstructorMethodBody public ColorPicker(ControlHost host)
: base(host)
{
Size = new Size(18, 6);
MaximumSize = Size;
MinimumSize = Size;
CanChangeText = false;
BorderStyle = BorderStyle.Rounded;
FocusedStyle = FocusedStyle.RenderAsNormal;
PickedColorChanged += delegate { RequestRender(); };
SelectedHexIndexChanged += delegate { RequestRender(); };
SelectedChannelIndexChanged += delegate { RequestRender(); };
KeyPress += ColorPicker_KeyPress;
}, Microsoft.CodeAnalysis.CSharp.Binder binder, Microsoft.CodeAnalysis.CSharp.NullableWalker.VariableState initialState, Microsoft.CodeAnalysis.DiagnosticBag diagnostics, bool createSnapshots, out Microsoft.CodeAnalysis.CSharp.NullableWalker.SnapshotManager snapshotManager = null, ref System.Collections.Immutable.ImmutableDictionary<Microsoft.CodeAnalysis.CSharp.Symbol, Microsoft.CodeAnalysis.CSharp.Symbol> remappedSymbols = null)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MethodCompiler.BindMethodBody(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol method = The runtime is unable to evaluate this expression., Microsoft.CodeAnalysis.CSharp.TypeCompilationState compilationState = {Microsoft.CodeAnalysis.CSharp.TypeCompilationState}, Microsoft.CodeAnalysis.CSharp.BindingDiagnosticBag diagnostics = {Microsoft.CodeAnalysis.CSharp.BindingDiagnosticBag}, Microsoft.CodeAnalysis.CSharp.NullableWalker.VariableState nullableInitialState = {Microsoft.CodeAnalysis.CSharp.NullableWalker.VariableState}, bool reportNullableDiagnostics = true, bool includesFieldInitializers, out Microsoft.CodeAnalysis.CSharp.ImportChain importChain, out bool originalBodyNested = 'originalBodyNested' threw an exception of type 'System.NullReferenceException', out Microsoft.CodeAnalysis.CSharp.MethodBodySemanticModel.InitialState forSemanticModel = {Microsoft.CodeAnalysis.CSharp.MethodBodySemanticModel.InitialState})
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol methodSymbol, int methodOrdinal = 25, ref Microsoft.CodeAnalysis.CSharp.Binder.ProcessedFieldInitializers processedInitializers = {Microsoft.CodeAnalysis.CSharp.Binder.ProcessedFieldInitializers}, Microsoft.CodeAnalysis.CSharp.SynthesizedSubmissionFields previousSubmissionFields = null, Microsoft.CodeAnalysis.CSharp.TypeCompilationState compilationState = {Microsoft.CodeAnalysis.CSharp.TypeCompilationState})
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol containingType = The runtime is unable to evaluate this expression.)
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedTypeAsync.AnonymousMethod__0()
Microsoft.CodeAnalysis.dll!Roslyn.Utilities.UICultureUtilities.WithCurrentUICulture.AnonymousMethod__0()
mscorlib.dll!System.Threading.Tasks.Task.Execute()
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot = Id = 352, Status = Running, Method = "Void <WithCurrentUICulture>b__0()")
mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution)
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()
This is the summary of the uploaded dump file:
Dump Summary
------------
Dump File: csc.exe.5532.dmp : C:\LocalDumps\csc.exe.5532.dmp
Last Write Time: 2022-02-12 09:45:58
Process Name: csc.exe : C:\Program Files\VS2022P\Msbuild\Current\Bin\Roslyn\csc.exe
Process Architecture: x64
Exception Code: 0x80131623
Exception Information:
Heap Information: Present
System Information
------------------
OS Version: 10.0.19042
CLR Version(s): 4.8.4420.0
Modules
-------
Module Name Module Path Module Version
----------- ----------- --------------
csc.exe C:\Program Files\VS2022P\Msbuild\Current\Bin\Roslyn\csc.exe 4.100.22.7108
ntdll.dll C:\Windows\System32\ntdll.dll 10.0.19041.1288
mscoree.dll C:\Windows\System32\mscoree.dll 10.0.19041.1
kernel32.dll C:\Windows\System32\kernel32.dll 10.0.19041.1348
KERNELBASE.dll C:\Windows\System32\KERNELBASE.dll 10.0.19041.1348
advapi32.dll C:\Windows\System32\advapi32.dll 10.0.19041.1052
msvcrt.dll C:\Windows\System32\msvcrt.dll 7.0.19041.546
sechost.dll C:\Windows\System32\sechost.dll 10.0.19041.906
rpcrt4.dll C:\Windows\System32\rpcrt4.dll 10.0.19041.1288
mscoreei.dll C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll 4.8.4180.0
shlwapi.dll C:\Windows\System32\shlwapi.dll 10.0.19041.1023
kernel.appcore.dll C:\Windows\System32\kernel.appcore.dll 10.0.19041.546
version.dll C:\Windows\System32\version.dll 10.0.19041.546
clr.dll C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll 4.8.4420.0
user32.dll C:\Windows\System32\user32.dll 10.0.19041.1202
win32u.dll C:\Windows\System32\win32u.dll 10.0.19041.1320
VCRUNTIME140_CLR0400.dll C:\Windows\System32\VCRUNTIME140_CLR0400.dll 14.10.25028.0
ucrtbase_clr0400.dll C:\Windows\System32\ucrtbase_clr0400.dll 14.10.25028.0
gdi32.dll C:\Windows\System32\gdi32.dll 10.0.19041.1202
gdi32full.dll C:\Windows\System32\gdi32full.dll 10.0.19041.1110
msvcp_win.dll C:\Windows\System32\msvcp_win.dll 10.0.19041.789
ucrtbase.dll C:\Windows\System32\ucrtbase.dll 10.0.19041.789
imm32.dll C:\Windows\System32\imm32.dll 10.0.19041.546
mscorlib.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\26a845b249aefca961715129e3e55539\mscorlib.ni.dll 4.8.4420.0
ole32.dll C:\Windows\System32\ole32.dll 10.0.19041.1202
combase.dll C:\Windows\System32\combase.dll 10.0.19041.1348
bcryptPrimitives.dll C:\Windows\System32\bcryptPrimitives.dll 10.0.19041.1348
cryptsp.dll C:\Windows\System32\cryptsp.dll 10.0.19041.546
rsaenh.dll C:\Windows\System32\rsaenh.dll 10.0.19041.1052
bcrypt.dll C:\Windows\System32\bcrypt.dll 10.0.19041.1023
CRYPTBASE.dll C:\Windows\System32\CRYPTBASE.dll 10.0.19041.546
System.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System\43b97e99fab55055761ec7618b2bf77b\System.ni.dll 4.8.4360.0
System.Core.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Core\73d4c7241519af17f6f645768e72fed4\System.Core.ni.dll 4.8.4390.0
csc.ni.exe C:\Windows\assembly\NativeImages_v4.0.30319_64\csc\5d73946086a9965c78fa4bbf7374720a\csc.ni.exe 4.100.22.7108
Microsoft.CodeAnalysis.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\Microsoft.Cbf18da00#\10e3c655bd903d9762eebfddd8af5401\Microsoft.CodeAnalysis.ni.dll 4.100.22.7108
Microsoft.CodeAnalysis.CSharp.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\Microsoft.C1d3c2215#\e62b5f979cc351af63720d68a442320e\Microsoft.CodeAnalysis.CSharp.ni.dll 4.100.22.7108
System.Collections.Immutable.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Coll4a4f96a7#\f924773233d5c5ab8e971f283475cc94\System.Collections.Immutable.ni.dll 5.0.20.51904
shell32.dll C:\Windows\System32\shell32.dll 10.0.19041.1320
windows.storage.dll C:\Windows\System32\windows.storage.dll 10.0.19041.1320
wldp.dll C:\Windows\System32\wldp.dll 10.0.19041.1320
SHCore.dll C:\Windows\System32\SHCore.dll 10.0.19041.1320
profapi.dll C:\Windows\System32\profapi.dll 10.0.19041.844
System.Text.Encoding.CodePages.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Textdf40403d#\3cc34bbc7beab2ba7581c43875404be3\System.Text.Encoding.CodePages.ni.dll 4.6.27129.4
System.Memory.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Memory\00b1c18ae6ac66090111d572a2e60bbf\System.Memory.ni.dll 4.6.28619.1
System.Runtime.CompilerServices.Unsafe.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Runtea61dfd5#\3d22bcd5005af37418d3e7aa8cee8dea\System.Runtime.CompilerServices.Unsafe.ni.dll 5.0.20.51904
System.Threading.Tasks.Extensions.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Thre95f54cb4#\e3467c922eb97be1a36e652be865d35c\System.Threading.Tasks.Extensions.ni.dll 4.6.28619.1
clrjit.dll C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll 4.8.4420.0
netstandard.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\netstandard\f9a59923dd9196982d2a51bca73b78d0\netstandard.ni.dll 4.8.4084.0
System.Globalization.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Globalization\7784cdf89606f49f657420e88020467e\System.Globalization.ni.dll 4.8.4084.0
clbcatq.dll C:\Windows\System32\clbcatq.dll 2001.12.10941.16384
System.Numerics.Vectors.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Numeb60ee252#\04c5581e765366fea283f9c0a2f3aafc\System.Numerics.Vectors.ni.dll 4.6.26515.6
System.Numerics.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Numerics\8fdd4ee70c2cdcd03c0eb25e4874a122\System.Numerics.ni.dll 4.8.4084.0
System.Reflection.Metadata.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Refl9556d6ea#\a466fdc08fca368a729b42a59a9c1400\System.Reflection.Metadata.ni.dll 5.0.20.51904
urlmon.dll C:\Windows\System32\urlmon.dll 11.0.19041.1320
iertutil.dll C:\Windows\System32\iertutil.dll 11.0.19041.1266
srvcli.dll C:\Windows\System32\srvcli.dll 10.0.19041.546
netutils.dll C:\Windows\System32\netutils.dll 10.0.19041.546
sspicli.dll C:\Windows\System32\sspicli.dll 10.0.19041.1266
propsys.dll C:\Windows\System32\propsys.dll 7.0.19041.1023
oleaut32.dll C:\Windows\System32\oleaut32.dll 10.0.19041.985
System.ValueTuple.ni.dll C:\Windows\assembly\NativeImages_v4.0.30319_64\System.ValueTuple\79e44312b45ce276a4d6e0b31d297ad3\System.ValueTuple.ni.dll 4.8.4084.0
diasymreader.dll C:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll 14.8.4084.0
System.Buffers.dll C:\Program Files\VS2022P\Msbuild\Current\Bin\Roslyn\System.Buffers.dll 4.6.28619.1
ILLink.RoslynAnalyzer.dll C:\Program Files\dotnet\sdk\6.0.200-preview.22055.15\Sdks\Microsoft.NET.Sdk\analyzers\ILLink.RoslynAnalyzer.dll 6.0.5.1904
Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll C:\Program Files\dotnet\sdk\6.0.200-preview.22055.15\Sdks\Microsoft.NET.Sdk\analyzers\Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll 6.0.5.1901
System.Text.Json.SourceGeneration.dll C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.1\analyzers\dotnet\cs\System.Text.Json.SourceGeneration.dll 6.0.5.6705
Microsoft.CodeAnalysis.NetAnalyzers.dll C:\Program Files\dotnet\sdk\6.0.200-preview.22055.15\Sdks\Microsoft.NET.Sdk\analyzers\Microsoft.CodeAnalysis.NetAnalyzers.dll 6.0.5.1901
I hope that this sort of helps. If not, just shoot me a message and I will try to help wherever I can.
@Unknown6656 Thanks. That helps a lot.
The exception is a NullReferenceException in method PlainUnboundLambdaState.ParameterName(int)
during nullable analysis, due to _parameterNames
being uninitialized. The expression being analyzed is PickedColorChanged += delegate { RequestRender(); };
.
I tried recreating the problem with some tiny code samples but didn't succeed yet.
Would you mind digging one more piece of information? Get the version information for C:\Program Files\VS2022P\MSBuild\Current\Bin\Roslyn\Microsoft.CodeAnalysis.CSharp.dll
.
To do that, find the file in File Explorer, right-click on it and open Properties. In the Details tab, please copy or screenshot the Product Version (should be something like 4.1.0-....+...
with a long hexadecimal sequence).
Sorry, it's annoying, there's not an easy way to copy that string from the Properties UI :-/
Oh, it looks like you already provided the version information I needed in OP: C# compiler: 4.1.0-3.22071.8 (https://github.com/dotnet/roslyn/commit/663228dd1656d5e5ca7bd38bd5c95e3d8c2b7b01). Thanks!
Wow, thanks @jcouv for responding that fast, and for tracking down the error source. The latter at least helps me track down the error in the source code and either remove the faulting code or try to refactor the code such that the compiler no longer crashes.
(I'm speaking of my own code base -- not the faulting code inside roslyn...)
I was able to repro the crash (code sample below). It requires a conversion of anonymous function (delegate { }
) to a delegate type involving nullability attributes.
Note: if you change from anonymous function syntax to lambda syntax (x, y) => {...}
or (_, _) => {...}
you will get a warning:
// (11,31): warning CS8622: Nullability of reference types in type of parameter 'y' of 'lambda expression' doesn't match the target delegate 'MyDelegate<object>' (possibly because of nullability attributes).
// PickedColorChanged += (x, y) => { System.Console.WriteLine(); };
Diagnostic(ErrorCode.WRN_NullabilityMismatchInParameterTypeOfTargetDelegate, "(x, y) =>").WithArguments("y", "lambda expression", "MyDelegate<object>").WithLocation(11, 31)
The crash occurs when we try to report this diagnostic on an anonymous function (parameters don't have names).
[Fact, WorkItem(59336, "https://github.com/dotnet/roslyn/issues/59336")]
public void ParameterNameCrash()
{
var source = @"
#nullable enable
public delegate void MyDelegate<T>(object sender, [System.Diagnostics.CodeAnalysis.MaybeNull] T e);
class C
{
public event MyDelegate<object>? PickedColorChanged;
void M()
{
PickedColorChanged += delegate { System.Console.WriteLine(); };
PickedColorChanged?.Invoke(this, this);
}
}";
var comp = CreateCompilation(new[] { source, MaybeNullAttributeDefinition });
comp.VerifyDiagnostics(
);
}
Thanks very much for tracking down this bug, @jcouv!
Your explanation does make sense to me. I have to admit, that I sometimes use delegate { ... }
and _ => { ... }
interchangeably - usually I use the former when creating anonymous functions which span multiple expression statements and do not make use of potential parameters.
I will be more careful in the future -- at least until milestone 17.2 😉
Fix should be in 17.2p2. Thanks much for the help tracking this down, @Unknown6656 !
Thank you very much for fixing the issue, Julien!
I used preview features of C# (!!), when this feature removed, csc had been exited I removed these new features and everything goes fine
I used preview features of C# (!!), when this feature removed, csc had been exited I removed these new features and everything goes fine
Which specific settings?
Thank you.
I used preview features of C# (!!), when this feature removed, csc had been exited I removed these new features and everything goes fine
Which specific settings?
Thank you.
If I remembered correctly: Options -> Environment -> Preview Features -> Use Previews of the .NET SDK
We are facing the same error, but are developing in a pure Linux environment, and builds are done inside Docker. Do you have any instructions on how to get a crashdump in Docker? All instructions I found were Windows based
@333fred @chsienki Would you have any tips on getting a crashdump from a .NET app inside a container?
Define the container with the correct variables to collect a dump on crash: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/collect-dumps-crash.
Version Used:
4.1.0-3.22071.8
(663228dd)6.0.200-preview.22055.15
Steps to Reproduce: I am trying to re-compile my library (Unknown6656/Unknown6656.Core@e36c60073ed88f5c5b2b2de89b3cf791fa0fefd7) which worked perfectly fine in VS 17.1 Preview 1.1 using .NET SDK 5.0.104.
However, I currently get the following error:
Here is the relevant section from the build log:
The
.csproj
file in question can be seen here: https://github.com/Unknown6656/Unknown6656.Core/blob/e36c60073ed88f5c5b2b2de89b3cf791fa0fefd7/Unknown6656.Core/Unknown6656.Core.csprojI already tried the following - without success:
bin/
andobj/
folders..vs/
folder and.user
/.suo
-files.Can someone help me on this issue? Thank you.