-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
I am using "dotnet watch" to launch and watch an extremely simple asp.net application which, for the purposes of this bug report, simply serves up a static index.html file. I have a browser open on that page, and I edit the file in VS (17.12.0).
The app targets .NET 8.0 - The machine has both 8.0 and 9.0 SDKs installed, and the version of dotnet watch which runs is determined by a global.json file.
With the 8.0 SDK, if I make a simple modification to index.html, dotnet watch displays the following:
dotnet watch ⌚ File changed: .\wwwroot\index.html.
dotnet watch 🔥 Hot reload of static file succeeded.
The browser is automatically refreshed, and the update is immediately visible.
With the 9.0 SDK, if I make the same kind of modification, in the same editor, I see the following output from dotnet watch:
dotnet watch ⌚ File added: .\wwwroot\pdarvkmr.5io~
dotnet watch ⌚ File deleted: .\wwwroot\index.html
dotnet watch ⌚ File added: .\wwwroot\pdarvkmr.5io~
dotnet watch ⌚ File deleted: .\wwwroot\index.html
dotnet watch 🔥 Hot Reload of static files succeeded.
dotnet watch ⌚ No hot reload changes to apply.
The browser is refreshed, but it's intermittent if the modification is visible without needing a second, manual, browser refresh (i.e. there's a race here, presumably the browser is refreshed too early).
I assume that the intermediate files are part of some kind of "safe save" process which VS uses, and dnw was previously smart enough (or dumb enough!) to ignore these, but is now picking them up and confusing itself.
I know from working on other dev-tool file-watchers that editors will always find ways to confuse them, but I think it's reasonable to expect that "dotnet watch" is not confused by Visual Studio, particularly when it used to work OK. There is only one "breaking change" release note for dnw in 9.0, and it doesn't apply here.
Reproduction
- Watch an asp.net project with a static html file
- Edit that file in Visual Studio
- Observe that dnw in 9.0 is confused by what file modification occurred.
Additional Info
.NET 8.0 --verbose startup output:
Determining projects to restore...
All projects are up-to-date for restore.
EmbeddedWebApp -> [ObfuscatedPath]\EmbeddedWebApp\bin\dnw\Debug\net8.0\EmbeddedWebApp.dll
Running WebPage.h builder
dotnet watch ⌚ Process id 35476 ran for 937ms
dotnet watch ⌚ Running MSBuild target 'GenerateWatchList' on '[ObfuscatedPath]\EmbeddedWebApp\EmbeddedWebApp.csproj'
dotnet watch 🚀 Started 'C:\Program Files\dotnet\dotnet.exe' with arguments 'msbuild /nologo [ObfuscatedPath]\EmbeddedWebApp\EmbeddedWebApp.csproj "/p:_DotNetWatchListFile=C:\Users\Will Dean\AppData\Local\Temp\tmplkoyyg.tmp" /nologo /v:n /t:GenerateWatchList /p:DotNetWatchBuild=true /p:DesignTimeBuild=true "/p:CustomAfterMicrosoftCommonTargets=C:\Program Files\dotnet\sdk\8.0.404\DotnetTools\dotnet-watch\8.0.404-servicing.24521.39\tools\net8.0\any\DotNetWatch.targets" "/p:CustomAfterMicrosoftCommonCrossTargetingTargets=C:\Program Files\dotnet\sdk\8.0.404\DotnetTools\dotnet-watch\8.0.404-servicing.24521.39\tools\net8.0\any\DotNetWatch.targets" /p:_DotNetWatchTraceOutput=true': process id 38436
dotnet watch ⌚ Process id 38436 ran for 391ms
dotnet watch ⌚ Watching 11 file(s) for changes
dotnet watch ⌚ dotnet-watch is configured to launch a browser on ASP.NET Core application startup.
dotnet watch ⌚ Configuring the app to use browser-refresh middleware.
dotnet watch ⌚ Refresh server running at wss://localhost:56238,ws://localhost:56239.
dotnet watch 🔥 HotReloadProfile: Default.
dotnet watch ⌚ Connecting to the application.
dotnet watch ⌚ Running EmbeddedWebApp with the following arguments: ''
dotnet watch 🚀 Started '[ObfuscatedPath]\EmbeddedWebApp\bin\dnw\Debug\net8.0\EmbeddedWebApp.exe' with arguments '': process id 34612
dotnet watch 🚀 Started
dotnet watch 🔥 Hot reload capabilities: Baseline AddMethodToExistingType AddStaticFieldToExistingType AddInstanceFieldToExistingType NewTypeDefinition ChangeCustomAttributes UpdateParameters GenericUpdateMethod GenericAddMethodToExistingType GenericAddFieldToExistingType.
[12:20:20 INF] Starting...
.NET 9.0 --verbose startup info
dotnet watch ⌚ Working directory: '[ObfuscatedPath]\EmbeddedWebApp'
dotnet watch ⌚ Watching with Hot Reload.
dotnet watch ⌚ DOTNET_WATCH_RESTART_ON_RUDE_EDIT = 'true'. Will restart without prompt.
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
💡 Press "Ctrl + R" to restart.
dotnet watch ⌚ Running MSBuild target 'GenerateWatchList' on '[ObfuscatedPath]\EmbeddedWebApp\EmbeddedWebApp.csproj'
dotnet watch 🚀 Launched 'C:\Program Files\dotnet\dotnet.exe' with arguments 'msbuild /nologo [ObfuscatedPath]\EmbeddedWebApp\EmbeddedWebApp.csproj "/p:_DotNetWatchListFile=C:\Users\Will Dean\AppData\Local\Temp\tmppeffge.tmp" /nologo /v:n /t:GenerateWatchList /p:DotNetWatchBuild=true /p:DesignTimeBuild=true "/p:CustomAfterMicrosoftCommonTargets=C:\Program Files\dotnet\sdk\9.0.100\DotnetTools\dotnet-watch\9.0.100-rtm.24529.9\tools\net9.0\any\DotNetWatch.targets" "/p:CustomAfterMicrosoftCommonCrossTargetingTargets=C:\Program Files\dotnet\sdk\9.0.100\DotnetTools\dotnet-watch\9.0.100-rtm.24529.9\tools\net9.0\any\DotNetWatch.targets" /p:_DotNetWatchTraceOutput=true': process id 476
dotnet watch ⌚ Process id 476 ran for 437ms.
dotnet watch ⌚ Watching 11 file(s) for changes
dotnet watch ⌚ Target process is '[ObfuscatedPath]\EmbeddedWebApp\bin\dnw\Debug\net8.0\EmbeddedWebApp.exe'
dotnet watch ⌚ Configuring the app to use browser-refresh middleware
dotnet watch ⌚ dotnet-watch is configured to launch a browser on ASP.NET Core application startup.
dotnet watch ⌚ Refresh server running at wss://localhost:56426,ws://localhost:56427.
dotnet watch 🔥 HotReloadProfile: Default.
dotnet watch ⌚ [EmbeddedWebApp (net8.0)] Waiting for application to connect to pipe 6d0d30b2-c55e-460d-b45f-8bfd37680577.
dotnet watch 🚀 [EmbeddedWebApp (net8.0)] Launched 'C:\Program Files\dotnet\dotnet.exe' with arguments '[env:DOTNET_MODIFIABLE_ASSEMBLIES=debug] [env:DOTNET_WATCH_HOTRELOAD_NAMEDPIPE_NAME=6d0d30b2-c55e-460d-b45f-8bfd37680577] "[env:DOTNET_STARTUP_HOOKS=C:\Program Files\dotnet\sdk\9.0.100\DotnetTools\dotnet-watch\9.0.100-rtm.24529.9\tools\net9.0\any\hotreload\Microsoft.Extensions.DotNetDeltaApplier.dll;C:\Program Files\dotnet\sdk\9.0.100\DotnetTools\dotnet-watch\9.0.100-rtm.24529.9\tools\net9.0\any\middleware\Microsoft.AspNetCore.Watch.BrowserRefresh.dll]" run': process id 33816
Using launch settings from [ObfuscatedPath]\EmbeddedWebApp\Properties\launchSettings.json...
Building...
dotnet watch 🕵️ [6d0d30b2-c55e-460d-b45f-8bfd37680577] Loaded into process: [ObfuscatedPath]\EmbeddedWebApp\bin\dnw\Debug\net8.0\EmbeddedWebApp.dll
dotnet watch 🕵️ [6d0d30b2-c55e-460d-b45f-8bfd37680577] Connecting to hot-reload server
dotnet watch 🕵️ [6d0d30b2-c55e-460d-b45f-8bfd37680577] Connected.
dotnet watch ⌚ [EmbeddedWebApp (net8.0)] Capabilities: 'Baseline AddMethodToExistingType AddStaticFieldToExistingType AddInstanceFieldToExistingType NewTypeDefinition ChangeCustomAttributes UpdateParameters GenericUpdateMethod GenericAddMethodToExistingType GenericAddFieldToExistingType'
dotnet watch ⌚ [EmbeddedWebApp (net8.0)] Build completed.
[12:24:42 INF] Starting...
dotnet watch ⌚ Solution:
dotnet watch ⌚ Project: [ObfuscatedPath]\EmbeddedWebApp\EmbeddedWebApp.csproj
dotnet watch ⌚ Document: [ObfuscatedPath]\EmbeddedWebApp\Program.cs [NK6zspago2WOYSP0AkwjGGXpnhjEAy12KwQ+0u78iCs=]
dotnet watch ⌚ Document: [ObfuscatedPath]\EmbeddedWebApp\Startup.cs [vLbZ2LmHj1nwjlIqOCzEx12tRMKwsrP9zz8iZnI0G0g=]
dotnet watch ⌚ Document: [ObfuscatedPath]\EmbeddedWebApp\obj\dnw\Debug\net8.0\.NETCoreApp,Version=v8.0.AssemblyAttributes.cs [96XZeJyGNiXhOf+Z4RE6UDgw9rhaiPYSmRbfg6x2tJ4=]
dotnet watch ⌚ Document: [ObfuscatedPath]\EmbeddedWebApp\obj\dnw\Debug\net8.0\EmbeddedWebApp.AssemblyInfo.cs [M8JjV6F4Cyt9NPvb8IIM2wucrcVZPOP8L8uzCqXg04w=]
dotnet watch ⌚ Config: [ObfuscatedPath]\EmbeddedWebApp\obj\dnw\Debug\net8.0\EmbeddedWebApp.GeneratedMSBuildEditorConfig.editorconfig [V/yBk6IbOX+h0aRS35CBEYoHc3CFvr2jncQc8B+7pqU=]
dotnet watch ⌚ Config: C:\Program Files\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\analyzers\build\config\analysislevel_8_default.globalconfig [AqvoHMovS1Aoopie98b3akwNsww5DhMbRVschVTGAv4=]
dotnet watch 🔥 Hot reload session started.
dotnet watch ⌚ Waiting for changes
Further technical details
- Include the output of
dotnet --info
.NET SDK:
Version: 9.0.100
Commit: 59db016f11
Workload version: 9.0.100-manifests.c6f19616
MSBuild version: 17.12.7+5b8665660
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100\
.NET workloads installed:
[android]
Installation Source: VS 17.12.35506.116, VS 17.12.35323.107
Manifest Version: 35.0.7/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.7\WorkloadManifest.json
Install Type: Msi
[aspire]
Installation Source: VS 17.12.35506.116, VS 17.12.35323.107
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: Msi
[maui-windows]
Installation Source: VS 17.12.35506.116, VS 17.12.35323.107
Manifest Version: 9.0.0/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.0\WorkloadManifest.json
Install Type: Msi
[maccatalyst]
Installation Source: VS 17.12.35506.116, VS 17.12.35323.107
Manifest Version: 18.0.9617/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.0.9617\WorkloadManifest.json
Install Type: Msi
[ios]
Installation Source: VS 17.12.35506.116, VS 17.12.35323.107
Manifest Version: 18.0.9617/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.0.9617\WorkloadManifest.json
Install Type: Msi
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
8.0.404 [C:\Program Files\dotnet\sdk]
9.0.100-rc.1.24452.12 [C:\Program Files\dotnet\sdk]
9.0.100-rc.2.24474.11 [C:\Program Files\dotnet\sdk]
9.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.1.24452.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-rc.1.24431.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0-rc.1.24452.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
[ObfuscatedPath]\EmbeddedWebApp\global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
- The IDE VS 17.12.0