You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I use a separate logger factory with its own ILogger interface implementation for the WithLoggerFactory call, then it is not possible to simply return zero in the implementation of the ILogger.BeginScope function.
This leads to a null pointer exception in TimeLoggerExtensions.Disposable.Dispose, because it is not checked here whether the member variable "Disposable" is set at all.
You can work around this by returning "new CompositeDisposable()" in ILogger.BeginScope, for example.
But you have to know that. This is not recognisable from the error message. I have not found anything about this in the documentation.
My suggestion would be to simply modify the Dispose function:
public void Dispose()
{
_sw.Stop();
_action(_sw.ElapsedMilliseconds);
_disposable?.Dispose();
}
The text was updated successfully, but these errors were encountered:
If I use a separate logger factory with its own ILogger interface implementation for the WithLoggerFactory call, then it is not possible to simply return zero in the implementation of the ILogger.BeginScope function.
This leads to a null pointer exception in TimeLoggerExtensions.Disposable.Dispose, because it is not checked here whether the member variable "Disposable" is set at all.
You can work around this by returning "new CompositeDisposable()" in ILogger.BeginScope, for example.
But you have to know that. This is not recognisable from the error message. I have not found anything about this in the documentation.
My suggestion would be to simply modify the Dispose function:
The text was updated successfully, but these errors were encountered: