Disable SIMD and remove fallback UI logic
Disabled WebAssembly SIMD support by adding `<WasmEnableSIMD>false</WasmEnableSIMD>` to the project file for compatibility or performance reasons. Removed the fallback UI and associated JavaScript logic from `App.razor`, including error handling for WebAssembly startup failures and the fallback message display. Simplified the Blazor startup script by removing error handling and fallback logic, leaving only the basic `window.Blazor.start()` call.
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
|
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
|
||||||
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode>
|
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode>
|
||||||
<WasmBuildNative>false</WasmBuildNative>
|
<WasmBuildNative>false</WasmBuildNative>
|
||||||
|
<WasmEnableSIMD>false</WasmEnableSIMD>
|
||||||
<InvariantGlobalization>false</InvariantGlobalization>
|
<InvariantGlobalization>false</InvariantGlobalization>
|
||||||
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
|
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -33,16 +33,6 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<Routes />
|
<Routes />
|
||||||
<div id="sf-client-startup-fallback" class="sf-startup-fallback" hidden>
|
|
||||||
<div class="sf-startup-fallback__card" role="alert" aria-live="assertive">
|
|
||||||
<h2>Application could not start</h2>
|
|
||||||
<p>
|
|
||||||
Your browser or its current settings don't support required features.
|
|
||||||
Please update the browser or contact IT support.
|
|
||||||
</p>
|
|
||||||
<button type="button" class="btn btn-primary btn-sm" onclick="location.reload()">Reload</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="_content/DevExpress.Blazor.Resources/js/preload-script.js"></script>
|
<script src="_content/DevExpress.Blazor.Resources/js/preload-script.js"></script>
|
||||||
<script src="js/typed.umd.js"></script>
|
<script src="js/typed.umd.js"></script>
|
||||||
<script src="js/receiver-signature.js?v=9"></script>
|
<script src="js/receiver-signature.js?v=9"></script>
|
||||||
@@ -52,79 +42,12 @@
|
|||||||
<script src="_framework/blazor.web.js" autostart="false"></script>
|
<script src="_framework/blazor.web.js" autostart="false"></script>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
var fallbackShown = false;
|
|
||||||
|
|
||||||
function getErrorText(reason) {
|
|
||||||
if (!reason) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof reason === 'string') {
|
|
||||||
return reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reason && typeof reason.message === 'string') {
|
|
||||||
return reason.message;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return JSON.stringify(reason);
|
|
||||||
} catch {
|
|
||||||
return String(reason);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isWasmStartupFailure(reason) {
|
|
||||||
var text = getErrorText(reason).toLowerCase();
|
|
||||||
return text.indexOf('wasm simd') >= 0 ||
|
|
||||||
text.indexOf('failed to start platform') >= 0 ||
|
|
||||||
text.indexOf('instantiate_wasm_module') >= 0 ||
|
|
||||||
text.indexOf('mono_download_assets') >= 0 ||
|
|
||||||
text.indexOf('/_framework/dotnet') >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showStartupFallback(reason) {
|
|
||||||
if (fallbackShown) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var root = document.getElementById('sf-client-startup-fallback');
|
|
||||||
if (!root) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reason) {
|
|
||||||
console.error('Blazor startup failed:', reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
fallbackShown = true;
|
|
||||||
root.removeAttribute('hidden');
|
|
||||||
root.hidden = false;
|
|
||||||
root.style.display = 'flex';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!window.WebAssembly || !window.Blazor || typeof window.Blazor.start !== 'function') {
|
if (!window.WebAssembly || !window.Blazor || typeof window.Blazor.start !== 'function') {
|
||||||
showStartupFallback('Browser/runtime prerequisites are missing.');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('unhandledrejection', function (event) {
|
|
||||||
if (isWasmStartupFailure(event.reason)) {
|
|
||||||
showStartupFallback(event.reason);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('error', function (event) {
|
|
||||||
var reason = event.error || event.message;
|
|
||||||
if (isWasmStartupFailure(reason)) {
|
|
||||||
showStartupFallback(reason);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.Blazor.start({
|
window.Blazor.start({
|
||||||
webAssembly: {}
|
webAssembly: {}
|
||||||
}).catch(function (error) {
|
|
||||||
showStartupFallback(error);
|
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user