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 breaks if there is @ref to the component on the page #51856

Closed
BerserkerDotNet opened this issue Apr 17, 2021 · 8 comments
Closed
Assignees
Labels
arch-wasm WebAssembly architecture area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc
Milestone

Comments

@BerserkerDotNet
Copy link

Describe the bug

Hot reload stops working when there is a @ref to the component on the page.

To Reproduce

  1. Create a new BlazorWasm project from VS
  2. Add "hotReloadProfile": "blazorwasm" to the launchSettings.json
  3. Change index.cshtml to be like:
      @page "/"
    
        <h1>Hello, world</h1>
    
         Welcome to your new app. fdf
    
        <SurveyPrompt Title="How is Blazor working for you?" @ref="componentRef" />
    
         @code{
               private SurveyPrompt componentRef;
         }
  4. Run dotnet watch
  5. Make a change on the index.html

Hot reload is not working at this point. If you remove the @ref, it starts working again.

Exceptions (if any)

Exception in the browser console.
image
dotnet watch reports that hot reload succeeded, but nothing changed on the page.

Further technical details

  • ASP.NET Core version 6.0.100-preview.3.21202.5
  • Microsoft Visual Studio Community 2019 Preview Version 16.10.0 Preview 2.0

.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.3.21202.5
Commit: aee38a6dd4

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-preview.3.21202.5\

Host (useful for support):
Version: 6.0.0-preview.3.21201.4
Commit: 236cb21

.NET SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.609 [C:\Program Files\dotnet\sdk]
3.1.300-preview-015048 [C:\Program Files\dotnet\sdk]
3.1.300-preview-015095 [C:\Program Files\dotnet\sdk]
5.0.100-rc.1.20452.10 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
5.0.101 [C:\Program Files\dotnet\sdk]
5.0.300-preview.21180.15 [C:\Program Files\dotnet\sdk]
6.0.100-preview.1.21103.13 [C:\Program Files\dotnet\sdk]
6.0.100-preview.3.21202.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.3.21201.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.3.21201.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-rc.1.20452.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-preview.3.21201.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@ghost
Copy link

ghost commented Apr 22, 2021

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. Because it's not immediately obvious that this is a bug in our framework, we would like to keep this around to collect more feedback, which can later help us determine the impact of it. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@SteveSandersonMS
Copy link
Member

Converting this into pure C# terms, this appears to be triggered on code like the following:

    public partial class Index : Microsoft.AspNetCore.Components.ComponentBase
    {
        protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
            __builder.AddMarkupContent(0, "Hello");
            __builder.OpenComponent<Microsoft.AspNetCore.Components.Routing.NavLink>(1);
            __builder.AddComponentReferenceCapture(2, (__value) => {
               someLink = (Microsoft.AspNetCore.Components.Routing.NavLink)__value;
            });
            __builder.CloseComponent();
        }

        private NavLink someLink;
    }

...when you edit the string literal Hello to Hello2.

@SteveSandersonMS SteveSandersonMS transferred this issue from dotnet/aspnetcore Apr 26, 2021
@dotnet-issue-labeler
Copy link

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 dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 26, 2021
@SteveSandersonMS SteveSandersonMS removed their assignment Apr 26, 2021
@SteveSandersonMS SteveSandersonMS added arch-wasm WebAssembly architecture area-VM-meta-mono labels Apr 26, 2021
@ghost
Copy link

ghost commented Apr 26, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Describe the bug

Hot reload stops working when there is a @ref to the component on the page.

To Reproduce

  1. Create a new BlazorWasm project from VS
  2. Add "hotReloadProfile": "blazorwasm" to the launchSettings.json
  3. Change index.cshtml to be like:
      @page "/"
    
        <h1>Hello, world</h1>
    
         Welcome to your new app. fdf
    
        <SurveyPrompt Title="How is Blazor working for you?" @ref="componentRef" />
    
         @code{
               private SurveyPrompt componentRef;
         }
  4. Run dotnet watch
  5. Make a change on the index.html

Hot reload is not working at this point. If you remove the @ref, it starts working again.

Exceptions (if any)

Exception in the browser console.
image
dotnet watch reports that hot reload succeeded, but nothing changed on the page.

Further technical details

  • ASP.NET Core version 6.0.100-preview.3.21202.5
  • Microsoft Visual Studio Community 2019 Preview Version 16.10.0 Preview 2.0

.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.3.21202.5
Commit: aee38a6dd4

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-preview.3.21202.5\

Host (useful for support):
Version: 6.0.0-preview.3.21201.4
Commit: 236cb21

.NET SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.609 [C:\Program Files\dotnet\sdk]
3.1.300-preview-015048 [C:\Program Files\dotnet\sdk]
3.1.300-preview-015095 [C:\Program Files\dotnet\sdk]
5.0.100-rc.1.20452.10 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
5.0.101 [C:\Program Files\dotnet\sdk]
5.0.300-preview.21180.15 [C:\Program Files\dotnet\sdk]
6.0.100-preview.1.21103.13 [C:\Program Files\dotnet\sdk]
6.0.100-preview.3.21202.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.3.21201.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.3.21201.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-rc.1.20452.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-preview.3.21201.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Author: BerserkerDotNet
Assignees: -
Labels:

arch-wasm, area-VM-meta-mono, untriaged

Milestone: -

@SteveSandersonMS
Copy link
Member

cc @lambdageek

@lambdageek lambdageek added area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc and removed area-VM-meta-mono labels Apr 26, 2021
@lambdageek lambdageek self-assigned this Apr 26, 2021
@lambdageek lambdageek added this to the 6.0.0 milestone Apr 26, 2021
@marek-safar marek-safar removed the untriaged New issue has not been triaged by the area owner label Jun 14, 2021
@lambdageek
Copy link
Member

This should start working once dotnet/roslyn#55407 makes it into the .NET SDK. Still on track for 6.0

@lambdageek
Copy link
Member

Actually this is related to #57387 (fixed by #57388)

@lambdageek
Copy link
Member

Verified that dotnet watch and blazorwasm and @ref all work together in 6.0.100-rc.1.21416.3

@ghost ghost locked as resolved and limited conversation to collaborators Sep 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-EnC-mono Hot Reload for WebAssembly, iOS/Android, etc
Projects
None yet
Development

No branches or pull requests

5 participants