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
System.InvalidOperationException: The logger is already frozen.
The exception is not thrown when builder.Services.GenericServicesSimpleSetup<>() is not called.
The issue appears to be linked to the DI container being built twice, once in the GenericServices Setup and then in builder.Build().
In the first occasion EF Core obtains a logger from the service collection triggering Serilog.
The issue also appears similar to another issue on JADNC.
Potential workarounds:
As mentioned in the abovementioned issue, using a null logger factory can suppress the issue at the cost of disabling logging for EF Core.
The change you want me to do isn't trivial and isn't a lot of people asking for this feature. I have others things to do so I'm not going to add this.
If you can work a way to add your feature works without breaking the current way it works I will look at it. Alternatively you can clone the code and create your own version.
Uh oh!
There was an error while loading. Please reload this page.
Description:
When trying to implement a two-state logger initialization with Serilog the application builder throws the following exception on build.
The exception is not thrown when
builder.Services.GenericServicesSimpleSetup<>()
is not called.The issue appears to be linked to the DI container being built twice, once in the GenericServices Setup and then in
builder.Build()
.In the first occasion EF Core obtains a logger from the service collection triggering Serilog.
The issue also appears similar to another issue on JADNC.
Potential workarounds:
As mentioned in the abovementioned issue, using a null logger factory can suppress the issue at the cost of disabling logging for EF Core.
Steps to reproduce:
Created a project repo where the issue can be explored: https://github.com/Dimi1010/EfCoreGenericServicesAndSerilogBootstrapRepo.
Run the project for reproduction.
Expected Behavior:
Exception should not be thrown and the app should start normally.
Actual Behavior:
Exception is thrown.
Versions Used:
The text was updated successfully, but these errors were encountered: