HotReloading stops refreshing a page in RazorPages/RazorView when we use async OnGet in @functions section
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
When I have async OnGet method in @functions sections then HotReload stops refreshing the page.
In Debug Console HotReload say that changes are pushed, page reloaded, but changes are not visible.
When i make OnGet method synchronous then all works perfectly.
Code example:
@page
@functions {
int i = 1;
public async Task OnGet()
{
i = 7;
}
}
### Expected Behavior
_No response_
### Steps To Reproduce
1. Create Asp.net Core project.
2. In Index.cshtml remove @model and add second code.
@functions {
int i = 1;
public async Task OnGet()
{
i = 7;
}
}
3. Run project
4. Change something in code
5. HotRealoding stops working
6. Change OnGet method synchonous void, and HotReloading starts working
### Exceptions (if any)
_No response_
### .NET Version
8.0.100
### Anything else?
_No response_
Contributor guide
Research direction
Reproduce the issue in Index.cshtml using the @functions section and async OnGet shown in the report, then compare it with the synchronous version. Start by tracing how Hot Reload handles Razor Pages updates and async OnGet execution. Done means changing the page causes the refreshed output to become visible without changing OnGet to synchronous.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- developer-experience, tooling, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100