Skip to content

Hot Reload failure in CSHTML #9494

Description

@neoGeneva

Type: Bug

Issue Description

Hot reload fails when editing CSHTML files. I occasionally get errors when editing Blazor filese also. Hot reload doesn't seem to trigger at all for .CS files, but that might be another issue entirely.

Looking in the hot reload logs the root cause seems to be Rude edit ChangingReloadableTypeNotSupportedByRuntime, which is followed by StreamJsonRpc.ConnectionLostException and then error ENC1002: Cannot apply changes -- unexpected error: 'Cannot apply changes -- unexpected error: '''

2026-07-03 09:35:22.817 [info]  Rude edit ChangingReloadableTypeNotSupportedByRuntime:8875 'C:\Projects\Rubber-Monkey\Source\RubberMonkey.Sales.Web\obj\Debug\net10.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Views/Shared/_Layout_cshtml.g.cs' line 367: 'public async override global::System.Threading.Tasks.Task ExecuteAsync()'
2026-07-03 09:35:32.270 [info]  ApplyChangesAsync called.
2026-07-03 09:35:32.273 [info]  Checking for code updates...
2026-07-03 09:35:32.284 [info]  Emitting solution update 11.1 for solution 'C:\Projects\Rubber-Monkey\Source\RubberMonkey.Sales.slnx'
2026-07-03 09:35:32.947 [info]  Found 1 potentially changed, 0 deleted document(s) in project 'C:\Projects\Rubber-Monkey\Source\RubberMonkey.Sales.Web\RubberMonkey.Sales.Web.csproj'
2026-07-03 09:35:32.957 [info]  Rude edit ChangingReloadableTypeNotSupportedByRuntime:8875 'C:\Projects\Rubber-Monkey\Source\RubberMonkey.Sales.Web\obj\Debug\net10.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Views/Shared/_Layout_cshtml.g.cs' line 367: 'public async override global::System.Threading.Tasks.Task ExecuteAsync()'
2026-07-03 09:35:32.962 [info]  Document changed, added, or deleted: 'C:\Projects\Rubber-Monkey\Source\RubberMonkey.Sales.Web\obj\Debug\net10.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Views/Shared/_Layout_cshtml.g.cs'
2026-07-03 09:35:32.969 [info]  Project summary for 'C:\Projects\Rubber-Monkey\Source\RubberMonkey.Sales.Web\RubberMonkey.Sales.Web.csproj': InvalidChanges
2026-07-03 09:35:32.991 [error]  ❌ Exception while emitting update: StreamJsonRpc.ConnectionLostException: The JSON-RPC connection with the remote party was lost before the request could complete.
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync(JsonRpcRequest request, Type expectedResultType, CancellationToken cancellationToken)
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at Microsoft.CodeAnalysis.BrokeredServices.BrokeredServiceProxy`1.InvokeAsync[TArgs,TResult](Func`4 operation, TArgs args, CancellationToken cancellationToken) in /_/src/Workspaces/Remote/Core/ServiceBrokerExtensions.cs:line 49
   at Microsoft.CodeAnalysis.EditAndContinue.ManagedHotReloadServiceProxy.GetAvailabilityAsync(Guid module, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.EditAndContinue.EditSession.ReportModuleDiagnosticsAsync(Guid mvid, Project oldProject, Project newProject, ImmutableArray`1 documentAnalyses, ArrayBuilder`1 diagnostics, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/EditAndContinue/EditSession.cs:line 157
   at Microsoft.CodeAnalysis.EditAndContinue.EditSession.EmitSolutionUpdateAsync(Solution solution, ActiveStatementSpanProvider solutionActiveStatementSpanProvider, UpdateId updateId, ImmutableDictionary`2 runningProjects, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/EditAndContinue/EditSession.cs:line 1299
2026-07-03 09:35:33.189 [error]  ❌ C:\Projects\Rubber-Monkey\Source\RubberMonkey.Sales.EntityFramework\RubberMonkey.Sales.EntityFramework.csproj (line 1): error ENC1002: Cannot apply changes -- unexpected error: 'Cannot apply changes -- unexpected error: '''
2026-07-03 09:35:33.220 [info]  Code changes could not be applied. Restarting the application is required.
2026-07-03 09:35:33.226 [info]  Hot Reload result: {"result":2,"projectsToRestart":[],"projectsToRebuild":[],"errorDescriptions":["Cannot apply changes -- unexpected error: 'Cannot apply changes -- unexpected error: '''"],"projectInstancesToRebuild":[],"projectInstancesToRestart":[]}
2026-07-03 09:35:33.226 [info]  Hot Reload can't automatically apply your changes. The app needs to be rebuilt to apply updates.

Extension version: 2.145.15
VS Code version: Code 1.127.0 (4fe60c8b1cdac1c4c174f2fb180d0d758272d713, 2026-06-30T10:52:33+02:00)
OS version: Windows_NT x64 10.0.26220
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz (12 x 2712)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x9bc4 [Intel(R) UHD Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=31.0.101.2140 ACTIVE
GPU1: VENDOR= 0x10de, DEVICE=0x1fb8 [NVIDIA Quadro T2000 with Max-Q Design], DRIVER_VERSION=32.0.15.9595
GPU2: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.8680
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.78GB (1.51GB free)
Process Argv --crash-reporter-id 415ab69e-4a8e-44d5-966e-12560b8b14e3
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
pythonvspyt551cf:31249601
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
82j33506:31327384
6abeh943:31336334
envsactivate1:31538736
478i5457:31521843
cloudbuttont:31379625
3efgi100_wstrepl:31403338
ddidtcf:31399634
ec5jj548:31422691
cp_cls_t_966_ss:31526232
4je02754:31466945
c3h7c220:31478652
ge8j1254_inline_auto_hint_haiku:31490510
38bie571_auto:31478678
cp_cls_c_1081:31454833
conptydll_true:31498968
ia-use-proxy-models-svc:31452481
e9c30283:31461165
test_treatment2:31471001
46204921:31447328
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
nes-extended-on:31455476
chat:31457767
8hig5102:31480529
89g7j272:31518289
7e187181:31503455
i2gc6536:31499202
52612955:31516516
ghj88844:31499326
ddid_c:31478207
hmra_i5g22:31518061
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
db5d2638:31499441
jb_cp_cls_t_632:31543129
56dj4588:31512888
32d76977:31512328
ha629193:31508444
cdk-lw-on:31524445
2cfga817_c:31522397
jh5f2457_c:31540921
api_cot_ctrl:31513533
hgf2d445:31529595
8hfba999:31537718
prpt_srch:31518468
jbcp_cls_pctr_t:31531130
61138546:31518536
cp_intellij_c_nes:31533503
jf4hg949:31526829
nes-curr-leftover-1500:31538366
h561g132:31533256
sessions_5:31532894
h7dd7680:31543284
ihg5j128:31534457
9gg7f176:31542112

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions