dotnet / dotnet/aspnetcore

`PollingFileWatcher` Issue while running `dotnet watch run` with wsl volume mounts

Open
#26,492 6 comments 0 reactions 0 assignees View on GitHub
affected-few area-commandlinetools bug feature-hot-reload investigate severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Describe the bug
A clear and concise description of what the bug is.

- Windows Version: Windows 10 with WSL2 integration
- Docker Desktop Version: 2.4.0.0 (48506) stable
- Not running inside a virtualized Windows e.g. on a cloud server or on a mac VM

I have a dotnet core project which is stored in c drive of my windows system.
I have wsl2 integration with my docker desktop.

I am trying to run my application in docker using `dotnet watch run` and wanted to reflect the changes I do in `MySampleService` in docker build.

When I do `docker-compose up`

I am getting following error in docker logs:

![FilePollingIssue](https://user-images.githubusercontent.com/39826745/94813526-63702a00-03f8-11eb-9ff8-9c4f07661d4f.png)

### Expected behavior
`dotnet watch run` executes without any issues and track the file changes done in `MySampleService` folder

### Actual behavior
`PollingFileWatcher` issue is occurring sometimes

### To Reproduce

I have following folder structure:
* Some Folder in C drive
* MySampleService
* bin
* obj
* some-code.cs
* docker-compose.yml

Following is my docker-compose.yml
```
version: "2.1"
services:
my-sample-service:
image: mcr.microsoft.com/dotnet/core/sdk:3.1-alpine
working_dir: /usr/src/app/MySampleService
volumes:
- ./MySampleService:/usr/src/app/MySampleService
environment:
"DOTNET_USE_POLLING_FILE_WATCHER": 1
entrypoint: "dotnet watch run --urls=http://0.0.0.0:5010"
ports:
- 5010:5010
healthcheck:
test: wget --quiet --spider http://localhost:5010/api/ping || exit 1
interval: 60s
timeout: 5s
retries: 20

```

### Exceptions (if any)

### Further technical details
- ASP.NET Core version : 3.1.302
- Include the output of `dotnet --info`
```
.NET Core SDK (reflecting any global.json):
Version: 3.1.302
Commit: 41faccf259

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.302\

Host (useful for support):
Version: 3.1.6
Commit: 3acd9b0cd1

.NET Core SDKs installed:
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.507 [C:\Program Files\dotnet\sdk]
2.1.516 [C:\Program Files\dotnet\sdk]
2.2.101 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]
3.1.302 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

```

- The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version: using command prompt to build and run

Can somebody help me in fixing this issue? 🙂

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.