webadvanced / Structuremap.MVC5

Apache License 2.0
21 stars 9 forks source link

Avoid exceptions disposing the dependency scope. #9

Open vgaltes opened 9 years ago

vgaltes commented 9 years ago

When the Dispose method of the StructureMapDependencyScope is called, an exception is thrown trying to access to System.Web.HttpContext.Current. Checking the value before using it will avoid this exception.

eddiegroves commented 9 years ago

Would be great to see the merged as I've also encountered this issue and have manually patched for now...

Edit: DisposeNestedContainer also needs a HttpContext null check, example: https://github.com/txavier/Structuremap.MVC5/commit/036b66bdf2b9026b931e8b50eebbd6dee9183b99#diff-c57e75de84d025d341013689b68aaccaL89

khandokar commented 8 years ago

But when i install from https://www.nuget.org/packages/StructureMap.MVC5/, ArgumentNullException: is not handled

B3nCr commented 7 years ago

I'm still seeing this exception.