question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BlazorWebView -> Unable to customize Blazor Startup

See original GitHub issue

Description

I’m converting a Blazor WebAssembly app to dotnet Maui and tried copying the existing WebAssembly index.html to Maui. This works great with a small change from <script src="_framework/blazor.webassembly.js" autostart="false"></script> to <script src="_framework/blazor.webview.js" autostart="false"></script>

In the WebAssembly app I am also customizing the Blazor startup: <script>Blazor.start({ loadBootResource: loadBootResourceUpdate });</script> When trying to use this in Maui I get the following error: image

I know that loadBootResource is specific to WebAssembly but there are some other options that some users might want to use.

The issue is that initializing the WebView will automatically start Blazor without taking autostart="false" into account.

Note that this is not blocking for me as I currently don’t need this functionality but just wanted to report this issue. I was just wondering if it’s possible to have a custom startup for a blazor webview.

Steps to Reproduce

  1. Create a new Blazor Maui application
  2. Make sure
  3. Add <script>Blazor.start();</script>
  4. Notice the following error image

Version with bug

Preview 10 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows

Affected platform versions

Android 11

Did you find any workaround?

No workaround as far as I am aware

Relevant log output

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dannyBiescommented, Dec 7, 2021

I must have read the old docs by accident as the JS initializers cover everything I could potentially need😄, thanks!

0reactions
Eiloncommented, Dec 7, 2021

Oh actually it looks like maybe you already saw this doc? But it seems that with JS initializers you can probably do what you need? Right now I don’t think that blazor.webview.js has anything to customize, but if that changes, we would want to make sure it works with autostart=‘false’

Read more comments on GitHub >

github_iconTop Results From Across the Web

BlazorWebView.
Building on these foundations, I have created a BlazorWebView "Control" that is easily embedded in (Native) UI frameworks on the following platforms: Xamarin ......
Read more >
Handle errors in ASP.NET Core Blazor apps
This article describes how Blazor manages unhandled exceptions and how to develop apps that detect and handle errors.
Read more >
Blazor Hybrid Web Apps with .NET MAUI
Through a BlazorWebView component, MAUI apps can use the Blazor Web framework ... public class Startup : IStartup { public void Configure(IAppHostBuilder ...
Read more >
Blazor Hybrid, Blazor WebView, MAUI Blazor... This is ...
You will have to do the startup in both applications but from there the app just runs. No need to change anything. Remove...
Read more >
Can I make a Blazor application that doesn't open in ...
1 Answer 1 ... it seems that you are trying to build a progressive web app (PWA for short). PWAs are built with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found