reactjs / React.NET

.NET library for JSX compilation and server-side rendering of React components
https://reactjs.net/
MIT License
2.3k stars 937 forks source link

Avoid the exception during Dispose by only calling SetObject() when t… #1219

Closed xecrets closed 3 years ago

xecrets commented 3 years ago

The problem is that if an attempt is made to dispose the container or otherwise try to dispose the HttpContextLifetimeProvider from a thread where HttpContext.Current is null, a ReactAspNetException is thrown, aborting the entire disposal of the container. This fix addresses the problem by only calling SetObject(null); where there is reason to do so.

dustinsoftware commented 3 years ago

Seems reasonable :)

dustinsoftware commented 3 years ago

Published in 5.2.11