dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.74k stars 1.07k forks source link

Hot reload does not work on Linux when the project name has a period (.NET 9 RC1) #43861

Closed asaf92 closed 1 month ago

asaf92 commented 1 month ago

Describe the bug

On dotnet 9 RC1 - hot-reload does not work when the project name includes a period (.).

To Reproduce

Hot reload will not work. A log message will show saying that the process is ignored. dotnet watch can still be used with the --no-hot-reload option, but this means that every change (or most changes) leads to rebuild.

Further technical details

I believe this is due to this change in #41324. It assumes that the target process path executable is going to have an extension like the processPath, but it doesn't have one.

dotnet watch 🕵️ [...] Ignoring process '/path/to/bug-example/BugExample.WebApp/bin/Debug/net9.0/BugExample.WebApp.dll', expecting '/path/to/bug-example/BugExample.WebApp/bin/Debug/net9.0/BugExample.WebApp'

Because it attempts to change the extension, it compares BugExample.WebApp.exe to BugExample.exe. This works when there's no . because ChangeExtension adds an extension when there's no period.

dotnet --info:

➜  BugExample.WebApp 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:     ubuntu
 OS Version:  20.04
 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-rc.1.24431.7
  Architecture: x64
  Commit:       static
dotnet-issue-labeler[bot] commented 1 month ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

dotnet-issue-labeler[bot] commented 1 month ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

baronfel commented 1 month ago

Thanks for the report! @tmat do you agree with the analysis, and if so what change would you suggest.

tmat commented 1 month ago

@baronfel The issue is in a workaround for https://github.com/dotnet/sdk/issues/40484. Best would be to fix that issue and remove the workaround from dotnet-watch. Meanwhile, working on a fix to the workaround.

asaf92 commented 1 month ago

Hi @tmat ! Thanks for the fix, much appreciated.

I noticed this fix is not available in dotnet9 rc2, will it be available in the dotnet9 release?