Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet-watch] Hot reload capabilities are sometimes not reported for blazor-wasm #36723

Closed
sergiojrdotnet opened this issue Sep 19, 2021 · 15 comments · Fixed by dotnet/sdk#23185
Labels
area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI bug This issue describes a behavior which is not expected - a bug. feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-dotnetwatch This issue is related to the dotnet-watch command-line tool (now external) feature-hot-reload This issue is related to the Hot Reload feaature
Milestone

Comments

@sergiojrdotnet
Copy link

Describe the bug

dotnet watch is not recognizing Razor changes on Blazor WebAssembly project.

To Reproduce

  1. dotnet new blazorwasm
  2. dotnet watch
  3. Apply a change on any razor file

Exceptions

image

Further technical details

.NET SDK (reflecting any global.json):
 Version:   6.0.100-rc.1.21458.32
 Commit:    d7c22323c4

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22000
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.100-rc.1.21458.32\

Host (useful for support):
  Version: 6.0.0-rc.1.21451.13
  Commit:  d7619cd4b1

.NET SDKs installed:
  6.0.100-rc.1.21458.32 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.0-rc.1.21451.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

image

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-hot-reload This issue is related to the Hot Reload feaature labels Sep 20, 2021
@mkArtakMSFT
Copy link
Member

Thanks for contacting us. We have tests validating that this works. So if you have some specific setup / repro setps that you'd like to share that would help us investigate this further.

@mkArtakMSFT mkArtakMSFT added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Sep 20, 2021
@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Sep 20, 2021
@sergiojrdotnet
Copy link
Author

sergiojrdotnet commented Sep 20, 2021

@mkArtakMSFT

2021-09-20-20-48-12.mp4

@sergiojrdotnet
Copy link
Author

sergiojrdotnet commented Sep 21, 2021

I also tested daily build 6.0.100-rc.2.21470.35 and the problem keeps occurring.

@mkArtakMSFT
Copy link
Member

Thanks @sergiojrdotnet . Did you by any chance try this from VS and/or know whether that will work?

@mkArtakMSFT mkArtakMSFT added investigate and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Sep 21, 2021
@mkArtakMSFT mkArtakMSFT added this to the 6.0.0 milestone Sep 21, 2021
@mkArtakMSFT mkArtakMSFT added area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI feature-dotnetwatch This issue is related to the dotnet-watch command-line tool (now external) and removed area-blazor Includes: Blazor, Razor Components labels Sep 21, 2021
@sergiojrdotnet
Copy link
Author

@mkArtakMSFT It didn't work either

2021-09-21-20-28-40.mp4

@MisinformedDNA
Copy link
Contributor

MisinformedDNA commented Sep 22, 2021

I'm seeing the same issue. Neither VS 2022 Preview 4.0 nor dotnet watch are working.

VS Info Microsoft Visual Studio Enterprise 2022 Preview Version 17.0.0 Preview 4.0 VisualStudio.17.Preview/17.0.0-pre.4.0+31710.8 Microsoft .NET Framework Version 4.8.03752

Installed Version: Enterprise

Visual C++ 2022 00476-70000-00000-AA425
Microsoft Visual C++ 2022

.NET Core Debugging with WSL 1.0
.NET Core Debugging with WSL

ASP.NET and Web Tools 2019 17.0.616.20688
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 17.0.616.20688
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 17.0.616.20688
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 17.0.616.20688
Azure Functions and Web Jobs Tools

C# Tools 4.0.0-4.21458.2+2bfff7b9348e779628a06b86af04b5239d3a926d
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.1.134+45632ee938.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 17.0.11 (54f19d2)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 6.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Razor (ASP.NET Core) 17.0.0.2143108+3355b17aa26a41735ddf03b9fd3f71df166c0411
Provides languages services for ASP.NET Core Razor.

Snapshot Debugging Extension 1.0
Snapshot Debugging Visual Studio Extension Detailed Info

SQL Server Data Tools 17.0.62108.30110
Microsoft SQL Server Data Tools

SQLite & SQL Server Compact Toolbox 4.8
SQLite & SQL Server Compact Toolbox adds scripting, import, export, rename, query execution and much more to SQL Server Compact & SQLite Data Connections.

Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools 17.0.0901.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.0.0-4.21458.2+2bfff7b9348e779628a06b86af04b5239d3a926d
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.0.0-beta.21431.1+a7e1ca9200c21fd832dd9829fe1c655b69424ae8
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions 1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.

Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

VisualStudio.DeviceLog 1.0
Information about my package

VisualStudio.Foo 1.0
Information about my package

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 17.0.0.266 (d17-0@56a1e79)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 17.0.0.101 (remotes/origin/main@533d7d10b)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 17.0.11 (a04c9af)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 12.0.99.13 (main/fe2e7e6)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: c633fe9
Java.Interop: xamarin/java.interop/main@b7982e4
ProGuard: Guardsquare/proguard@912d149
SQLite: xamarin/sqlite@a575761
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@9b658b2

Xamarin.iOS and Xamarin.Mac SDK 14.99.0.598 (11838db7d)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

@pranavkm
Copy link
Contributor

@sergiojrdotnet for your VS issue, unfortunately we haven't made hot reload for Blazor WebAssembly work with the debugger as yet. We're looking at addressing it, but it's unlikely to be solved prior to VS 2022 GA. However, if you run the app without the debugger attached (Ctrl+F5) it should work with VS 17.0 Preview 4.1. Do you mind giving that a try?

@MisinformedDNA could I bother you to file a separate issue (assuming it's not addressed by my previous comment)?

@sergiojrdotnet
Copy link
Author

@pranavkm Yeah! It works on VS without debugger attached. Excelent!

@pranavkm
Copy link
Contributor

For watch, we made a fix for a timing issue in the RC2 SDK that I think might address the issue you are seeing. You could try a nightly build of the installer to see if it helps with the odd behavior you were seeing.

@sergiojrdotnet
Copy link
Author

sergiojrdotnet commented Sep 23, 2021

@pranavkm It looks weird. With version 6.0.100-rc.2.21473.35 didn't work in the first attempt, worked after some time and now does not work anymore. I'm trying to figure out what could possibly be interfering.

@pranavkm
Copy link
Contributor

If you run dotnet watch --verbose, it should print some logs about that might help.

@sergiojrdotnet
Copy link
Author

sergiojrdotnet commented Sep 23, 2021

I really can't find what is happening. After every run, sometimes it works, sometimes not.

2021-09-23-20-03-51.mp4

@pranavkm
Copy link
Contributor

It's a result of not being to infer the hot reload capabilities. The 2nd time around it print an empty string instead of "Hot reload capabilities: Baseline". I thought I'd fixed it, but perhaps didn't fix it hard enough

@pranavkm pranavkm added bug This issue describes a behavior which is not expected - a bug. and removed investigate labels Sep 23, 2021
@pranavkm pranavkm changed the title No hot reload changes to apply RC1/Blazor WASM [dotnet-watch] Hot reload capabilities are sometimes not reported for blazor-wasm Sep 23, 2021
@mkArtakMSFT mkArtakMSFT removed this from the 6.0.0 milestone Nov 2, 2021
@ziaulhasanhamim
Copy link

ziaulhasanhamim commented Nov 10, 2021

Having the same issue. working perfectly fine with vs 2022. but not with dotnet cli. no hot reload changes are applied. Everytime I made a change I have to restart. I'm using the dotnet SDK 6.0.1 GA

@ziaulhasanhamim
Copy link

any progress on this issue?

pranavkm added a commit to dotnet/sdk that referenced this issue Dec 27, 2021
In a Blazor app, the apply-update capabilities are available after the app is up and running in the browser.
Occasionally it takes long for the app to start up and our baseline task times out. Currently we return an empty
list of capabilities which causes the compiler to produce no deltas. This PR bumps up the timeout ever so slightly
and returns baseline capabilities instead.

Fixes dotnet/aspnetcore#36723
pranavkm added a commit to dotnet/sdk that referenced this issue Dec 30, 2021
In a Blazor app, the apply-update capabilities are available after the app is up and running in the browser.
Occasionally it takes long for the app to start up and our baseline task times out. Currently we return an empty
list of capabilities which causes the compiler to produce no deltas. This PR bumps up the timeout ever so slightly
and returns baseline capabilities instead.

Fixes dotnet/aspnetcore#36723
pranavkm added a commit to dotnet/sdk that referenced this issue Jan 3, 2022
In a Blazor app, the apply-update capabilities are available after the app is up and running in the browser.
Occasionally it takes long for the app to start up and our baseline task times out. Currently we return an empty
list of capabilities which causes the compiler to produce no deltas. This PR bumps up the timeout ever so slightly
and returns baseline capabilities instead.

Fixes dotnet/aspnetcore#36723
pranavkm added a commit to dotnet/sdk that referenced this issue Jan 3, 2022
* Assume basline capabilities (#23185)

In a Blazor app, the apply-update capabilities are available after the app is up and running in the browser.
Occasionally it takes long for the app to start up and our baseline task times out. Currently we return an empty
list of capabilities which causes the compiler to produce no deltas. This PR bumps up the timeout ever so slightly
and returns baseline capabilities instead.

Fixes dotnet/aspnetcore#36723

* Use project path instead of working directory to resolve launchSettings.json (#23184)

* Use project path instead of working directory to resolve launchSettings.json

Fixes dotnet/aspnetcore#35393

* Update DotNetWatcherTests.cs
@ghost ghost locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI bug This issue describes a behavior which is not expected - a bug. feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-dotnetwatch This issue is related to the dotnet-watch command-line tool (now external) feature-hot-reload This issue is related to the Hot Reload feaature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants