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.06k stars 4.04k forks source link

ENC0003: AggregateException with NRE inside in VS 17.6 Preview 3 #26126

Open chucker opened 6 years ago

chucker commented 6 years ago

Version Used: 15.7.0 Preview 3.0, .NET 4.7.03056, Windows v1803 17133.73, Roslyn 2.8.0-beta3-62727-06

Steps to Reproduce:

No idea how to reproduce this, I'm afraid. The change was fairly trivial, from:

LL.ExportOptions[LlExportOption.ExportFile] = "asd";

To:

LL.ExportOptions[LlExportOption.ExportFile] = $"{_BerichtName} {_ContainerID}";

Of note, however, this change occurs in an assembly that, while part of the solution, was injected using reflection; it is not directly referenced from the main assembly.

Expected Behavior: Hitting F5 should try to recompile this and resume the process.

Actual Behavior: An ENC0003 error shows up in the Error List, with the following Description:

Can't apply changes -- unexpected error: 'System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object. 
 at Microsoft.CodeAnalysis.EditAndContinue.EditSession.<GetAllAddedSymbols>d__33.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.EditAndContinue.EditSession.<EmitProjectDeltaAsync>d__39.MoveNext()--- End of stack trace from previous location where exception was thrown --- 
 at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) 
 --- End of inner exception stack trace ------> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object. 
 at Microsoft.CodeAnalysis.EditAndContinue.EditSession.<GetAllAddedSymbols>d__33.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.EditAndContinue.EditSession.<EmitProjectDeltaAsync>d__39.MoveNext()--- End of stack trace from previous location where exception was thrown --- 
 at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)<---'
chucker commented 6 years ago

(As expected, undoing and re-doing the change while still in the same debugger session works fine.)