-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-hot-reloadThis issue is related to the Hot Reload feaatureThis issue is related to the Hot Reload feaature
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Please note: This is not the same as the 404 for blazor-hotreload.js, which has been fixed with #36897, but this is the second part of #35555 which I believe was missed.
The fetch request for _framework/blazor-hotreload from blazor-hotreload.js returns 404 due to the url being relative to the subdirectory, contents of blazor-hotreload.js:
export function receiveHotReload() {
return BINDING.js_to_mono_obj(new Promise((resolve) => receiveHotReloadAsync().then(resolve(0))));
}
async function receiveHotReloadAsync() {
const cache = window.sessionStorage.getItem('blazor-webassembly-cache');
let headers;
if (cache) {
headers = { 'if-none-match' : cache.etag };
}
const response = await fetch('_framework/blazor-hotreload', { headers });
if (response.status === 200) {
const deltas = await response.json();
if (deltas) {
try {
deltas.forEach(d => window.Blazor._internal.applyHotReload(d.moduleId, d.metadataDelta, d.ilDelta));
} catch (error) {
console.warn(error);
return;
}
}
}
}Expected Behavior
blazor-hotreload should load successfully and hot reload should work
Steps To Reproduce
- Create a hosted ASP.NET Core + Blazor WebAssembly Project
- Configure it to operate under a subdirectory (set base href, StaticWebAssetBasePath etc)
- Run the hosted project.
- Observe that
blazor-hotreload.jsloads correctly but requests_framework/blazor-hotreload(relative to the subdirectory), breaking hot reload.
Repro: https://github.com/crackalak/BlazorHotReload404
Exceptions (if any)
No response
.NET Version
6.0.201
Anything else?
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-hot-reloadThis issue is related to the Hot Reload feaatureThis issue is related to the Hot Reload feaature
