Possible bug in Context Preservation extension in combination with the new Factory extension?

105 views
Skip to first unread message

Marco Erni

unread,
Mar 19, 2012, 11:03:49 AM3/19/12
to nin...@googlegroups.com
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
Test.cs

Remo Gloor

unread,
Mar 19, 2012, 8:00:47 PM3/19/12
to nin...@googlegroups.com
I'll have a look when I find some time later this week.

Remo

Von meinem iPad gesendet
--
You received this message because you are subscribed to the Google Groups "ninject" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ninject/-/-soO5q5q3G4J.
To post to this group, send email to nin...@googlegroups.com.
To unsubscribe from this group, send email to ninject+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ninject?hl=en.
<Test.cs>

Remo Gloor

unread,
Mar 26, 2012, 7:38:07 PM3/26/12
to nin...@googlegroups.com
You are right.
Please try Ninject.Extensions.ContextPreservation 3.0.1 from teamcity.codebetter.com

Marco Erni

unread,
Mar 28, 2012, 2:47:44 AM3/28/12
to nin...@googlegroups.com
Hi Remo
 
I have tested with the latest build from teamcity. It works now as expected.
Can you release the fixed version also on nuget?
 
Thank you for your fast repsonse & the fix.
Marco

Marco Erni

unread,
Sep 19, 2012, 9:41:27 AM9/19/12
to nin...@googlegroups.com
Hi Remo

I have seen that the newest version of the context preservation extension (3.0.1) is not published on nuget.
Are there any plans to release them on nuget?

Thanks
Marco
Reply all
Reply to author
Forward
0 new messages