We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d29c7f commit 811bc67Copy full SHA for 811bc67
src/React.AspNet/HttpContextLifetimeProvider.cs
@@ -57,7 +57,15 @@ private PerRequestRegistrations Registrations
57
{
58
get
59
60
- var registrations = HttpContext.RequestServices.GetService<PerRequestRegistrations>();
+ var requestServices = HttpContext.RequestServices;
61
+ if (requestServices == null)
62
+ {
63
+ throw new ReactNotInitialisedException(
64
+ "ASP.NET request services have not been initialised correctly. Please " +
65
+ "ensure you are calling app.UseRequestServices() before app.UseReact()."
66
+ );
67
+ }
68
+ var registrations = requestServices.GetService<PerRequestRegistrations>();
69
if (registrations == null)
70
71
throw new ReactNotInitialisedException(
0 commit comments