Hi
When I use the ContextPreservationExtension and the FactoryExtension and when I get a factory instance directly from the kernel I always get a NullReferenceException in the ContextPreservationResolutionRoot.
I know that is not the best way to get instances directly from the kernel, but it is a special case in our MSpec based acceptance tests, where we need some sort of factories directly from the kernel.
I have attached a unit test that reproduces the bug.
Just create a new class library and get the follwing nuget packages:
Install-Package Ninject -Pre
Install-Package Ninject.Extensions.Factory -Pre
Install-Package Ninject.Extensions.ContextPreservation -Pre
Install-Package xUnit
I have figured out that when I get the factory instance directly from the kernel, the ContextPreservationResolutionRoot is instatied without a context. And so subsequent calls to CreateRequest will throw the NullReferenceException.
Tankes for any help
Marco