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
I'm trying to run my ASP.NET Core project, running under .NET Framework 4.7.2, to run in Azure Service Fabric. However I'm getting System.NullReferenceException at React.AspNet.HttpContextLifetimeProvider.get_Registrations() , when running app.UseReact(...).
The exception looks similar to #600 [Rendering without HTTPContext]
It works in Azure Service Fabric on my development computer, but I cannot for the life of me figure out what's wrong in Azure or what's missing in the VMs.
Startup.cs, ConfigureServices contains this code before call to services.AddMvc(...):
System.RA' reported Warning for property 'ReplicaOpenStatus'. Replica had multiple failures during open on _Primary_0. API call: IStatelessServiceInstance.Open(); Error = System.NullReferenceException (-2147467261) Object reference not set to an instance of an object.
at React.AspNet.HttpContextLifetimeProvider.get_Registrations()
at React.AspNet.HttpContextLifetimeProvider.ReleaseObject()
at React.TinyIoC.SafeDictionary2.set_Item(TKey key, TValue value)
at React.TinyIoC.TinyIoCContainer.RegisterRegisterType,RegisterImplementation
at React.AssemblyRegistration.Register(TinyIoCContainer container)
at React.Initializer.InitializeIoC(Func2 requestLifetimeRegistration)
at React.AspNet.ReactBuilderExtensions.UseReact(IApplicationBuilder app, Action`1 configure, BabelFileOptions fileOptions) at AdminWeb.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in C:\CloudIDE\Workspaces\Codemander\Azure Service Fabric\AdminWeb\Startup.cs:line 1082
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
at Microsoft.ServiceFabric.Services.Communication.AspNetCore.AspNetCoreCommunicationListener.OpenAsync(CancellationToken cancellationToken)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__13.MoveNext()
The text was updated successfully, but these errors were encountered:
Hmm.. if service fabric explicitly disallows IHttpContextAccessor from accessing the current context then you may be out of luck here for right now. The library needs some form of temporary storage for DI to work properly.
That said, we may be able to swap out TinyIoCContainer with a lightweight wrapper around .NET Core DI when targeting netcoreapp (which might fix your issue). I have not done enough digging in this area to say for sure whether that will work; if you end up forking the library and taking a stab this, I would love to support this scenario, since HttpContext is only really used to facilitate DI.
Please verify these steps before filing an issue, and check them off as you go
JavaScriptEngineSwitcher.V8.Native.win-x64
)SetUseReact
andSetUseBabel
is correct inReactConfig.cs
orStartup.cs
I'm using these library versions:
ReactJS.NET
: 4.2.0-beta1JavaScriptEngineSwitcher
: 3.1.1react
andreact-dom
: N/Awebpack
: N/Anode
: N/ARuntime environment:
VS 2019 Build Tools workloads installed in Azure Service Fabric VMs:
I'm trying to run my ASP.NET Core project, running under .NET Framework 4.7.2, to run in Azure Service Fabric. However I'm getting System.NullReferenceException at React.AspNet.HttpContextLifetimeProvider.get_Registrations() , when running app.UseReact(...).
The exception looks similar to #600 [Rendering without HTTPContext]
It works in Azure Service Fabric on my development computer, but I cannot for the life of me figure out what's wrong in Azure or what's missing in the VMs.
Startup.cs, ConfigureServices contains this code before call to services.AddMvc(...):
Startup.cs, Configure contains this code (no custom configuration) before call to app.UseStaticFiles();:
app.UseReact(config =>{});
I've tried changing
void ConfigureServices(...)
to
Any tips on how to hunt this down?
Exception:
System.RA' reported Warning for property 'ReplicaOpenStatus'. Replica had multiple failures during open on _Primary_0. API call: IStatelessServiceInstance.Open(); Error = System.NullReferenceException (-2147467261) Object reference not set to an instance of an object.
at React.AspNet.HttpContextLifetimeProvider.get_Registrations()
at React.AspNet.HttpContextLifetimeProvider.ReleaseObject()
at React.TinyIoC.SafeDictionary2.set_Item(TKey key, TValue value)
at React.TinyIoC.TinyIoCContainer.RegisterRegisterType,RegisterImplementation
at React.AssemblyRegistration.Register(TinyIoCContainer container)
at React.Initializer.InitializeIoC(Func2 requestLifetimeRegistration)
at React.AspNet.ReactBuilderExtensions.UseReact(IApplicationBuilder app, Action`1 configure, BabelFileOptions fileOptions) at AdminWeb.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in C:\CloudIDE\Workspaces\Codemander\Azure Service Fabric\AdminWeb\Startup.cs:line 1082
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
at Microsoft.ServiceFabric.Services.Communication.AspNetCore.AspNetCoreCommunicationListener.OpenAsync(CancellationToken cancellationToken)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__13.MoveNext()
The text was updated successfully, but these errors were encountered: