Skip to content

dotnet watch run watches the .git folder. #43817

Open
@StringEpsilon

Description

Describe the bug

The dotnet watch run command watches the .git folder of my project, sometimes even recompiling due to this error:

Unable to apply hot reload, restart is needed to apply the changes.

From a simple git stash / git stash pop:

dotnet watch ⌚ Files added: ./.git/objects/3c/tmp_obj_S92RQS, ./.git/index.lock, ./.git/index, ./.git/objects/3c/82172b9f73e35b3b42e3653c719df4db9726ec
dotnet watch ⌚ Files added: ./.git/objects/3c/tmp_obj_S92RQS, ./.git/index.lock, ./.git/index, ./.git/objects/3c/82172b9f73e35b3b42e3653c719df4db9726ec
dotnet watch ⌚ No hot reload changes to apply.
Files added: ./.git/index.lock, ./.git/index, ./.git/AUTO_MERGE, ./test, ./.git/AUTO_MERGE.lock
dotnet watch ⌚ Files added: ./.git/index.lock, ./.git/index, ./.git/AUTO_MERGE, ./test, ./.git/AUTO_MERGE.lock
dotnet watch ⌚ No hot reload changes to apply.

To Reproduce

  1. Create a new test application in a new git repository where the .csproj file is located in the git root folder.
  2. touch test
  3. git add test
  4. dotnet watch run
  5. git stash -S

Now observe the dotnet watch console output.

Exceptions (if any)

N/A

Further technical details

  • dotnet --info output:
dotnet --info
	.NET SDK:
	Version:           9.0.100-rc.1.24452.12
	Commit:            81a714c6d3
	Workload version:  9.0.100-manifests.a7bf2b8f
	MSBuild version:   17.12.0-preview-24422-09+d17ec720d

Runtime Environment:
OS Name: arch
OS Version:
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/9.0.100-rc.1.24452.12/

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.

Host:
Version: 9.0.0-preview.7.24405.7
Architecture: x64
Commit: static

.NET SDKs installed:
6.0.133 [/usr/share/dotnet/sdk]
8.0.108 [/usr/share/dotnet/sdk]
9.0.100-rc.1.24452.12 [/usr/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.1.24452.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.33 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-rc.1.24431.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
DOTNET_ROOT [/usr/share/dotnet]

global.json file:
Not found

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions