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

Hot Reload: Adding a new [Parameter] property to a components code block triggers a restart instead of applying the change at runtime #34480

Closed
MacdonaldRobinson opened this issue Jul 18, 2021 · 2 comments
Assignees
Labels
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
Milestone

Comments

@MacdonaldRobinson
Copy link

Describe the bug

Hot Reload: Adding a new [Parameter] property to a components code block triggers a restart instead of applying the change at runtime

image

To Reproduce

  • In WSL - Ubuntu 20.04 LTS
  • Create a new web app using "dotnet new blazorwasm"
  • Use "code ." to open it in VS Code
  • In the Terminal type "dotnet watch"
  • Open the link in the browser
  • Open Shared/SurveyPrompt.razor
  • Add a new parameter property to the code block called "Title2"
  • Save the file
  • In the console you will see the error "Unable to handle changes to /home/mac/src/blazorwasm/Shared/SurveyPrompt.razor. Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?"

Expectation

Adding new parameters to a component is a very common task that should be hot reloaded

Output of dotnet --info

.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.6.21355.2
Commit: 7f8e0d76c0

Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /home/mac/dotnet/sdk/6.0.100-preview.6.21355.2/

Host (useful for support):
Version: 6.0.0-preview.6.21352.12
Commit: 770d630b28

.NET SDKs installed:
6.0.100-preview.6.21355.2 [/home/mac/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.0-preview.6.21355.2 [/home/mac/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0-preview.6.21352.12 [/home/mac/dotnet/shared/Microsoft.NETCore.App]

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

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-hot-reload This issue is related to the Hot Reload feaature labels Jul 19, 2021
@javiercn
Copy link
Member

@MacdonaldRobinson thanks for contacting us.

That might be by design (although I'll let @pranavkm confirm. The reason is the same I mentioned on the previous issue, if you add or remove state from a class (fields) that causes a change on the class layout, which requires a restart.

@mkArtakMSFT mkArtakMSFT added the feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly label Jul 19, 2021
@mkArtakMSFT mkArtakMSFT added this to the Discussions milestone Jul 19, 2021
@pranavkm
Copy link
Contributor

@MacdonaldRobinson unfortunately Mono / WASM currently does not support adding custom attributes (the Parameter). This is being tracked via dotnet/runtime#52993.

The feature works in .NET Core so this should work with Blazor Server.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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
Projects
None yet
Development

No branches or pull requests

4 participants