Skip to content

dotnet watch sometimes broken when ItemGroup was added #58603

Open
@AndiRudi

Description

@AndiRudi

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

In our .net 8 project we are using dotnet watch to make use of live updates for UI changes in our MVC application. This process works well except sometimes when hot reloading is not working anymore. When this occurs changing some text in a cshtml file does not trigger an reload of the web browser. The output of dotnet watch for any file within the project is something like this:

File changed: ./Views/x/y.cshtml.
No hot reload changes to apply.

It is also worth mentioning that this detection is quite slow (seconds) compared to the usual detection within milliseconds.

Now we have already found a a quick fix that might lead to the cause. At least "Rider" (Maybe also other IDEs) sometimes add new/changed files to the csproj file as an ItemGroup like so:

 <ItemGroup>
    <AdditionalFiles Include="Areas\Admin\Views\x\y.cshtml" />
  </ItemGroup> 

When something like that happens hot reloading does not work anymore (like written above) until this line is removed.

Expected Behavior

Expected behavior is, that dotnet watch always works and is not easily broken by such changes or that some more logs are written to help to solve the issue.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

8.0.401

Anything else?

.NET SDK:
Version: 8.0.401
Commit: 811edcc344
Workload version: 8.0.400-manifests.57f7c351
MSBuild version: 17.11.4+37eb419ad

Runtime Environment:
OS Name: Mac OS X
OS Version: 15.0
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.401/

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
[aspire]
Installation Source: SDK 8.0.400
Manifest Version: 8.2.0/8.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.aspire/8.2.0/WorkloadManifest.json
Install Type: FileBased

Host:
Version: 9.0.0-rc.2.24473.5
Architecture: arm64
Commit: 990ebf52fc

.NET SDKs installed:
8.0.401 [/usr/local/share/dotnet/sdk]
9.0.100-rc.2.24474.11 [/usr/local/share/dotnet/sdk]. <--- It is not related to that, I had this before installing 9

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
/Users/xx/Developer/xx/global.json

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-commandlinetoolsIncludes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions