Hot reload breaks with `System.ArgumentException: Expected method symbol (Parameter 'oldSymbol') `
untriaged
### Description
I was running `dotnet watch --verbose` in hopes of diagnosing another hot reload bug, when my Aspire project shut down and threw an error, after I modified a file.
### Reproduction Steps
I failed to reproduce it in a small, self-contained project, alas.
### Expected behavior
Things work fine
### Actual behavior
```
dotnet watch ⌚ File updated: .\Ogma3\Api\V1\Comments\GetRevision.cs
dotnet watch ⭐ Stop session dotnet/runtime#1
dotnet watch ⌚ [Ogma3 (net10.0)] Terminating process 49984 (Ctrl+C).
dotnet watch ⭐ [#1] Sending 'serviceLogs': log_message='[00:34:10 INF] Application is shutting down...', is_std_err=False
dotnet watch ⌚ [Ogma3 (net10.0)] Waiting for process 49984 to exit within 5s.
dotnet watch ⭐ [#1] Sending 'serviceLogs': log_message='[00:34:10 INF] SocketClosed (ProtocolExitClient, last-recv: 0) on localhost:6379/Subscription, Idle/MarkProcessed, last: QUIT, origin: ReadFromPipe, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: ConnectedEstablished, mgr: 9 of 10 available, in: 0, in-pipe: 0, out-pipe: 0, last-heartbeat: 0s ago, global: 0s ago, v: 2.10.1.65101', is_std_err=False
dotnet watch ⭐ [#1] Sending 'serviceLogs': log_message='StackExchange.Redis.RedisConnectionException: SocketClosed (ProtocolExitClient, last-recv: 0) on localhost:6379/Subscription, Idle/MarkProcessed, last: QUIT, origin: ReadFromPipe, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: ConnectedEstablished, mgr: 9 of 10 available, in: 0, in-pipe: 0, out-pipe: 0, last-heartbeat: 0s ago, global: 0s ago, v: 2.10.1.65101', is_std_err=False
dotnet watch ⌚ [Ogma3 (net10.0)] Process id 49984 ran for 1810448ms and exited with exit code 0.
dotnet watch ⌚ [Ogma3 (net10.0)] Exited
dotnet watch ⭐ [#1] Sending 'sessionTerminated': pid=49984, exit_code=0
dotnet watch 🔥 [Ogma3 (net10.0)] Disposing agent communication pipe
dotnet watch ⌚ Terminating remaining child processes.
dotnet watch ⌚ [Ogma3.AppHost (net10.0)] Terminating process 26344 (Ctrl+C).
dotnet watch ⌚ [Ogma3.AppHost (net10.0)] Waiting for process 26344 to exit within 5s.
dotnet watch ⌚ [Ogma3.AppHost (net10.0)] Process id 26344 ran for 1819962ms and exited with exit code 0.
dotnet watch ⌚ [Ogma3.AppHost (net10.0)] Exited
dotnet watch 🔥 [Ogma3.AppHost (net10.0)] Disposing agent communication pipe
dotnet watch ⭐ Application is shutting down...
dotnet watch ⭐ Waiting for server to shutdown ...
dotnet watch ⭐ Executed endpoint '/run_session/notify'
dotnet watch ⭐ Request finished HTTP/1.1 GET https://localhost:54640/run_session/notify?api-version=2024-04-23 - 101 - - 1815010.3714ms
dotnet watch ❌ An unexpected error occurred: System.ArgumentException: Oczekiwano symbolu metody (Parameter 'oldSymbol')
at Microsoft.CodeAnalysis.Emit.SemanticEdit..ctor(SemanticEditKind kind, ISymbol oldSymbol, ISymbol newSymbol, Func`2 syntaxMap, Func`2 runtimeRudeEdit, MethodInstrumentation instrumentation)
at Microsoft.CodeAnalysis.EditAndContinue.EditSession.MergePartialEditsAsync(Compilation oldCompilation, Compilation newCompilation, Project oldProject, Project newProject, IReadOnlyList`1 edits, 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, ImmutableDictionary`2 runningProjects, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.EditAndContinue.DebuggingSession.EmitSolutionUpdateAsync(Solution solution, ImmutableDictionary`2 runningProjects, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.ExternalAccess.Watch.Api.WatchHotReloadService.GetUpdatesAsync(Solution solution, ImmutableDictionary`2 runningProjects, CancellationToken cancellationToken)
at Microsoft.DotNet.Watch.CompilationHandler.HandleManagedCodeChangesAsync(Boolean autoRestart, Func`3 restartPrompt, CancellationToken cancellationToken)
at Microsoft.DotNet.Watch.HotReloadDotNetWatcher.WatchAsync(CancellationToken shutdownCancellationToken)
at Microsoft.DotNet.Watch.HotReloadDotNetWatcher.WatchAsync(CancellationToken shutdownCancellationToken)
at Microsoft.DotNet.Watch.Program.RunAsync()
task: Failed to run task "watch-dbg": exit status 1
```
### Regression?
_No response_
### Known Workarounds
_No response_
### Configuration
* .NET 10.0.100
* Windows 11
* x64
### Other information
Logs gathered with `--verbose` and `Microsoft_CodeAnalysis_EditAndContinue_LogDir` env var: [2026-01-16_00-03-04.zip](https://github.com/user-attachments/files/24656177/2026-01-16_00-03-04.zip)
0 条评论