Description
When modifying a model class (e.g., adding a new field to a class used in a Web API response), hot reload reports success (dotnet watch 🔥 Hot reload of changes succeeded.), but the changes do not reflect in the actual API response. The updated field is not included in the JSON output unless the application is fully restarted.
This affects productivity, as hot reload is expected to apply such changes without requiring a full restart.
Steps to reproduce:
Create a Web API project using dotnet new webapi.
Add a model class used in a controller response.
Run the app using dotnet watch run.
Modify the model class to add a new property (e.g., a new bool or string property).
Observe that hot reload reports success.
Call the endpoint using Postman/curl/browser and confirm that the new field is missing in the response.
Stop and restart the app manually.
Call the endpoint again and observe the new field now appears.
Exceptions (if any)
No exceptions are thrown. The response simply omits the newly added field until the application is restarted.
dotnet --info
.NET SDK:
Version: 8.0.407
Commit: cac65f27eb
Workload version: 8.0.400-manifests.20e9918b
MSBuild version: 17.11.26+2b19be476
Runtime Environment:
OS Name: Mac OS X
OS Version: 15.3
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.407/
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.
Host:
Version: 8.0.14
Architecture: arm64
Commit: 1584e49360
.NET SDKs installed:
6.0.417 [/usr/local/share/dotnet/sdk]
8.0.203 [/usr/local/share/dotnet/sdk]
8.0.204 [/usr/local/share/dotnet/sdk]
8.0.407 [/usr/local/share/dotnet/sdk]
IDE: VSCode Version: 1.98.2
Commit: ddc367ed5c8936efe395cffeec279b04ffd7db78
Date: 2025-03-12T13:32:45.399Z
Electron: 34.2.0
ElectronBuildId: 11161602
Chromium: 132.0.6834.196
Node.js: 20.18.2
V8: 13.2.152.36-electron.0
OS: Macos Darwin arm64 24.3.0