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:
Developer 02 2025-09-30 19:56:58 +02:00
parent d5a8619b4d
commit 5a3cbe8ecf

View File

@ -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);