-
Notifications
You must be signed in to change notification settings - Fork 29
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
Are there any plans to support Blazor WASM projects? #79
Comments
Hello! In your Blazor component, are you able to use If you're using Thanks! |
@nblumhardt actually we are using MEL and public static IServiceCollection AddConfigurableSerilog(this IServiceCollection services, IConfiguration configuration) =>
services
.AddSerilog(new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.CreateLogger(),
true)
; So we do not use And there are some third party components which are not always async disposable so we have no control here either. |
Where are you tearing down the service collection, though? It should be possible to async-dispose it, I believe this will use the non-async dispose for components that don't support Logging to Seq (and most other network targets) is asynchronous for performance reasons; if you want to flush the background buffer on disposal then a network call is required, and in the browser these generally need to be async. Definitely open to (and keen to) improve the default experience here, but I suspect there may not be many options available 🤔 |
It's not just the components that use logging but other services too. And not all of them are |
Using |
We are using |
Ah, that's interesting. Are you somehow creating multiple instances of Providing the full call stack for the associated exception would narrow this down. |
Good catch. After your comment I did some digging and found there were some pieces of code that created an PeriodicBatchingSink (Serilog.Sinks.Seq.Batched.BatchedSeqSink): caught exception during disposal
System.PlatformNotSupportedException: Cannot wait on monitors on this runtime.
at System.Threading.Monitor.ObjWait(Int32 millisecondsTimeout, Object obj)
at System.Threading.Monitor.Wait(Object obj, Int32 millisecondsTimeout)
at System.Threading.ManualResetEventSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.SpinThenBlockingWait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.InternalWaitCore(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.InternalWait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait() |
In it's current state (4.1.0) there is an exception inside
Dispose(bool disposing)
method:serilog-sinks-periodicbatching/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSink.cs
Lines 331 to 355 in d7b0406
This line:
serilog-sinks-periodicbatching/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSink.cs
Line 339 in d7b0406
Causes this:
This exception is output in Serilog's self log (when enabled).
In our project we wanted to use serilog-sinks-seq or serilog-sinks-http sinks to send logs to
Seq
server directly from browser, but they both depend on this project and both fail on this.Just wanted to know if there are any plans to somehow workaround WASM limitations?
The text was updated successfully, but these errors were encountered: