Improve exception message in Static.cs
Updated the exception message in the `Static` class to clarify that services cannot be accessed after the service provider has been created. This change enhances the clarity of the error for developers.
This commit is contained in:
parent
d5a8619b4d
commit
5a3cbe8ecf
@ -18,7 +18,7 @@ public class Static
|
||||
|
||||
public static IServiceCollection Services => LazyProvider.IsValueCreated
|
||||
? LazyServices.Value
|
||||
: throw new InvalidOperationException("Service collection is not available after the service provider has been built.");
|
||||
: throw new InvalidOperationException("Services cannot be accessed after the Provider has been created.");
|
||||
|
||||
private static readonly Lazy<IServiceProvider> LazyProvider = new Lazy<IServiceProvider>(Services.BuildServiceProvider);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user