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
Version Used: .NET 9.0.102 or 9.0.200-preview.0.25057.12
Steps to Reproduce:
In a console app, build and run the following:
Console.ReadLine();publicclassTest{publicstaticvoidMethod1(){}publicstaticvoidMethod2(){}}[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]classTest1{publicclassNested{publicvoidInvoke(){Test.Method1();}}}//[global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdate]//class Test1//{// public class Nested2// {// public void Invoke()// {// Test.Method2();// }// }//}
Comment the first Test1 class
Uncomment the second Test1 block
Apply the changes
Diagnostic Id: None
If this is a report about a bug in an analyzer, please include the diagnostic ID and message if possible (e.g. "IDE0030: Use coalesce expression").
Expected Behavior: The update is being applied without an exception.
Actual Behavior: The following error is displayed by the IDE:
System.InvalidOperationException: Unexpected null - file EditSession.cs line 688
at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber, String filePath)
at Microsoft.CodeAnalysis.EditAndContinue.EditSession.MergePartialEdits(Compilation oldCompilation, Compilation newCompilation, IReadOnlyList`1 edits, ImmutableArray`1& mergedEdits, ImmutableHashSet`1& addedSymbols, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.EditAndContinue.EditSession.GetProjectChangesAsync(ActiveStatementsMap baseActiveStatements, Compilation oldCompilation, Compilation newCompilation, Project oldProject, Project newProject, ImmutableArray`1 changedDocumentAnalyses, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.EditAndContinue.EditSession.EmitSolutionUpdateAsync(Solution solution, ActiveStatementSpanProvider solutionActiveStatementSpanProvider, UpdateId updateId, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.EditAndContinue.DebuggingSession.EmitSolutionUpdateAsync(Solution solution, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.ExternalAccess.Watch.Api.WatchHotReloadService.GetUpdatesAsync(Solution solution, Func`2 isRunningProject, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.ExternalAccess.Watch.Api.WatchHotReloadService.EmitSolutionUpdateAsync(Solution solution, CancellationToken cancellationToken)
Note that the issue happens because both the inner class name and the body of the Invoke method are changing. If the body does not change and only the class name, the error does not happen.
The text was updated successfully, but these errors were encountered:
Version Used: .NET 9.0.102 or 9.0.200-preview.0.25057.12
Steps to Reproduce:
In a console app, build and run the following:
Comment the first
Test1
classUncomment the second
Test1
blockApply the changes
Diagnostic Id: None
If this is a report about a bug in an analyzer, please include the diagnostic ID and message if possible (e.g.
"IDE0030: Use coalesce expression"
).Expected Behavior: The update is being applied without an exception.
Actual Behavior: The following error is displayed by the IDE:
Note that the issue happens because both the inner class name and the body of the
Invoke
method are changing. If the body does not change and only the class name, the error does not happen.The text was updated successfully, but these errors were encountered: