-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaks a WASM .NET 7 app #20
Comments
Hi! I had a quick shot at reproducing this - looks a little like a Blazor hot reload bug, at first glance, since the app works fine with I've opened #21 to update the tooling and target versions of this project anyway. If someone has time to dig in and debug further, it'd be great to narrow this down enough to either mitigate here, or post a bug report/repro to the Blazor folks. |
I had the same problem after updating to .NET 7, but worked around it by removing any call to Log.Info/Error/etc from Client Program.cs |
Are there any updates on this issue? |
Hi! This needs someone with Blazor knowledge (and time) to investigate. It's most likely a bug in Blazor hot reloading (production code would most likely never be expected to throw |
Hey guys, they asked me to provide a minimal repro project. |
@here please take a look at the issue that I created, the guys from Blazor diagnosed it and found that it is actually a browser console issue dotnet/aspnetcore#45536 WebAssemblyHost app = builder.Build();
Log.Logger = new LoggerConfiguration()
.WriteTo.BrowserConsole(
restrictedToMinimumLevel: LogEventLevel.Information,
outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}",
CultureInfo.InvariantCulture,
jsRuntime: app.Services.GetRequiredService<IJSRuntime>())
.CreateLogger();
await app.RunAsync(); The workaround is to pass the jsRuntime |
Awesome! Thanks for following that up! I'm not sure about the conclusions regarding internal state - Serilog.Sinks.BrowserConsole only uses public APIs as far as I can tell (?) - but seems like the way forward will be to require an injected Should be fixable with a new |
If we initialize the app with this sink, the app throws a null reference exception on the initialization of the app, causing it to fail to start.
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.AspNetCore.Components.WebAssembly.HotReload.WebAssemblyHotReload.InitializeAsync() at Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHost.RunAsyncCore(CancellationToken cancellationToken, WebAssemblyCultureProvider cultureProvider) at Program.<Main>$(String[] args) in C:\xxxxxxxxxxx\Program.cs:line 147
The text was updated successfully, but these errors were encountered: