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

DOMException: Failed to execute 'setStartBefore' on 'Range': the given Node has no parent. #52126

Closed
1 task done
giuseppe-terrasi opened this issue Nov 16, 2023 · 15 comments · Fixed by #52647
Closed
1 task done
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Milestone

Comments

@giuseppe-terrasi
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

After upgrading an existing Blazor Server side on .NET 7 to a Blazor App in .NET 8 I get this javascript error when navigating:

Uncaught (in promise) DOMException: Failed to execute 'setStartBefore' on 'Range': the given Node has no parent.
    at q (https://localhost:7001/_framework/blazor.web.js:1:20110)
    at yi (https://localhost:7001/_framework/blazor.web.js:1:167970)
    at wi (https://localhost:7001/_framework/blazor.web.js:1:169913)
    at yi (https://localhost:7001/_framework/blazor.web.js:1:167646)
    at wi (https://localhost:7001/_framework/blazor.web.js:1:169913)
    at yi (https://localhost:7001/_framework/blazor.web.js:1:167646)
    at vi (https://localhost:7001/_framework/blazor.web.js:1:165963)
    at https://localhost:7001/_framework/blazor.web.js:1:176131
    at Object.write (https://localhost:7001/_framework/blazor.web.js:1:174447)

After that, the server streaming part of the page doesn't load. This is totally random.

The same project works fine with the previous version of the framework,

Expected Behavior

Navigate from one page to another without any problem

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

8.0.100

Anything else?

.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.8d38d0cc

Ambiente di runtime:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.100\

Carichi di lavoro .NET installati:
Workload version: 8.0.100-manifests.8d38d0cc
[android]
Origine dell'installazione: VS 17.8.34309.116
Versioni del manifesto: 34.0.43/8.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.43\WorkloadManifest.json
Tipo di installazione: Msi

[maui-windows]
Origine dell'installazione: VS 17.8.34309.116
Versioni del manifesto: 8.0.3/8.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.3\WorkloadManifest.json
Tipo di installazione: Msi

[maccatalyst]
Origine dell'installazione: VS 17.8.34309.116
Versioni del manifesto: 17.0.8478/8.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\17.0.8478\WorkloadManifest.json
Tipo di installazione: Msi

[ios]
Origine dell'installazione: VS 17.8.34309.116
Versioni del manifesto: 17.0.8478/8.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\17.0.8478\WorkloadManifest.json
Tipo di installazione: Msi

Host:
Version: 8.0.0
Architecture: x64
Commit: 5535e31a71

.NET SDKs installed:
3.1.426 [C:\Program Files\dotnet\sdk]
5.0.408 [C:\Program Files\dotnet\sdk]
6.0.302 [C:\Program Files\dotnet\sdk]
6.0.320 [C:\Program Files\dotnet\sdk]
7.0.203 [C:\Program Files\dotnet\sdk]
8.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.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:
Not found

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Nov 16, 2023
@javiercn
Copy link
Member

@giuseppe-terrasi thanks for contacting us.

Could you provide a minimal repro project as a public github repository as well as a detailed set of steps to trigger the issue?

@javiercn javiercn added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Needs: Repro Indicates that the team needs a repro project to continue the investigation on this issue labels Nov 16, 2023
@ghost
Copy link

ghost commented Nov 16, 2023

Hi @giuseppe-terrasi. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@ghost
Copy link

ghost commented Nov 16, 2023

Thank you for filing this issue. In order for us to investigate this issue, please provide a minimal repro project that illustrates the problem without unnecessary code. Please share with us in a public GitHub repo because we cannot open ZIP attachments, and don't include any confidential content.

@giuseppe-terrasi
Copy link
Author

@javiercn thanks for your reply.
I've simplified the app functionalities inside this test repo. The problem happens when navigating between Counter and Weather pages but, as I said, it is random. Maybe, the docker layer can cause it after some wrong code refresh.

@ghost
Copy link

ghost commented Nov 20, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.

@giuseppe-terrasi
Copy link
Author

I linked the requested repo

@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. Status: No Recent Activity labels Nov 20, 2023
@rubenvannieuwpoort
Copy link

rubenvannieuwpoort commented Nov 24, 2023

For the record, we're seeing the same problem with our Blazor webapp when we click links very shortly after a reload.

Uncaught (in promise) DOMException: Failed to execute 'setStartBefore' on 'Range': the given Node has no parent.
    at q (https://our-app.azurewebsites.net/_framework/blazor.web.js:1:20110)
    at yi (https://our-app.azurewebsites.net/_framework/blazor.web.js:1:167970)
    at wi (https://our-app.azurewebsites.net/_framework/blazor.web.js:1:169913)
    at yi (https://our-app.azurewebsites.net/_framework/blazor.web.js:1:167646)
    at wi (https://our-app.azurewebsites.net/_framework/blazor.web.js:1:169913)
    at yi (https://our-app.azurewebsites.net/_framework/blazor.web.js:1:167646)
    at vi (https://our-app.azurewebsites.net/_framework/blazor.web.js:1:165963)
    at https://our-app.azurewebsites.net/_framework/blazor.web.js:1:176131
    at Object.write (https://our-app.azurewebsites.net/_framework/blazor.web.js:1:174447)

@capdiem
Copy link

capdiem commented Nov 28, 2023

I have the same issue. As long as you put an interactive component in MainLayout, then route to the weather page, refresh, and then visit other pages, this error will occur.

@sfnmk
Copy link

sfnmk commented Nov 28, 2023

Same here. Similar error appears randomly while navigating between pages with interactive components. In my case the error is:

Uncaught (in promise) TypeError: Failed to execute 'setEndAfter' on 'Range': parameter 1 is not of type 'Node'.
    at q (blazor.web.js:1:20130)
    at yi (blazor.web.js:1:167970)
    at wi (blazor.web.js:1:169913)
    at yi (blazor.web.js:1:167646)
    at wi (blazor.web.js:1:169913)
    at yi (blazor.web.js:1:167646)
    at vi (blazor.web.js:1:165963)
    at blazor.web.js:1:176131
    at Object.write (blazor.web.js:1:174447)
q @ blazor.web.js:1
yi @ blazor.web.js:1
wi @ blazor.web.js:1
yi @ blazor.web.js:1
wi @ blazor.web.js:1
yi @ blazor.web.js:1
vi @ blazor.web.js:1
(anonymous) @ blazor.web.js:1
write @ blazor.web.js:1
await in write (async)
(anonymous) @ blazor.web.js:1
Ne @ blazor.web.js:1
xi @ blazor.web.js:1

@MackinnonBuck MackinnonBuck added the bug This issue describes a behavior which is not expected - a bug. label Dec 7, 2023
@MackinnonBuck MackinnonBuck removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. Needs: Repro Indicates that the team needs a repro project to continue the investigation on this issue labels Dec 7, 2023
@mkArtakMSFT mkArtakMSFT added this to the 8.0.x milestone Dec 11, 2023
@mkArtakMSFT mkArtakMSFT modified the milestones: 8.0.x, 8.0.2 Jan 16, 2024
@turnercj65
Copy link

Hey @MackinnonBuck I just ran into this issue. I'm able to successfully repro this as you described with an interactive component in the top level of the app's layout, refresh the browser while on a page with streaming enabled that uses the layout, and perform an enhanced navigation to another page, also sharing the same layout.

@GZidar
Copy link

GZidar commented Apr 4, 2024

I too am seeing this problem. We are using v8.0.3 with an interactive component in the app layout.

Uncaught (in promise) DOMException: Failed to execute 'setStartBefore' on 'Range': the given Node has no parent.
at q (_framework/blazor.web.js:1:20110)
at yi (_framework/blazor.web.js:1:168298)
at wi (_framework/blazor.web.js:1:170259)
at yi (_framework/blazor.web.js:1:167974)
at wi (_framework/blazor.web.js:1:170259)
at yi (_framework/blazor.web.js:1:167974)
at vi (_framework/blazor.web.js:1:166291)
at _framework/blazor.web.js:1:176564
at Object.write (_framework/blazor.web.js:1:174880)

@MackinnonBuck
Copy link
Member

@turnercj65, @GZidar, are you using the 8.0.204 SDK? If not, could you please try that and see if it resolves your issue? Please also make sure your package versions are up-to-date. If this resolves the problem, could you please let us know? If not, we would appreciate a minimal repro project that demonstrates the issue, hosted as a public GitHub repository. I tried to create my own repro with an interactive component in the layout, and the issue did not occur. Thanks!

@CoreyT65
Copy link

Thanks @MackinnonBuck I've updated to the latest SDK and updated all nuget packages and still running into this only when published to azure app service (windows in my case). I'm not able to repro this when running locally, but consistent repro when published to azure.

@MackinnonBuck
Copy link
Member

@CoreyT65 It sounds like you might be running into a similar issue to what @sbwalker hit as described in this comment. Could you try using a custom deployment that uses the latest .NET SDK?

@CoreyT65
Copy link

@MackinnonBuck Yep, adding the 8.04 extension to the app service did the trick. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

10 participants