dotnet / dotnet/aspnetcore

Blazor Activity links on global render vs per-page rendermode are totally different

Open
#64,554 1 comment 0 reactions 1 assignee Claimed by @javiercn View on GitHub
area-blazor investigate
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

On project with per-page rendermode, the traces are pretty useless.

`Microsoft.AspNetCore.Components.Navigate` adds links to the route and then stores it in the link store. https://github.com/dotnet/aspnetcore/blob/27fe84d1b17e218c66b53351799687aec7a7598d/src/Components/Components/src/ComponentsActivitySource.cs#L47

However, when an event handler is run, that is in circuit context, which has a DIFFERENT `_componentsActivityLinkStore` and thus the links it was supposed to add does not exist.

### Expected Behavior

On ``
Image
and link to page activity in the event activity:

Image

### Steps To Reproduce

1. make new blank blazor with aspire and global rendermode.
2. Start project
3. Click Counter link
4. Click Increment a few times
5. Find trace in aspire -> CORRECT
6. convert app to per-page (or just create another with per-page rendermode)
a. remove global rendermode
b. add rendermode to home and counter page
7. do 2-5 again -> INCORRECT

### Exceptions (if any)

On page level `@rendermode`

Image

Image

### .NET Version

10.0.100

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.