trquth / autofac

Automatically exported from code.google.com/p/autofac
Other
0 stars 0 forks source link

MVC integration broken in versions post 3.0.0beta2 - NullReferenceException #479

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Add a version of Autofac post 3.0.0beta2 to our MVC project
2. Navigate to an MVC page

What is the expected output? What do you see instead?

We are seeing the NullReferenceException listed on this page: 
https://groups.google.com/forum/#!msg/autofac/iUiwxYv31ss/VivVr0qMghoJ when 
visiting any MVC page.

What version of Autofac are you using? On what version of .NET/Silverlight?

All versions from 3.0.0beta2 to 3.1.5 are affected. The change which caused the 
problem is the fix for issue 351.

https://code.google.com/p/autofac/source/detail?r=e553f3cd3ecdcb95959b7ec3a05e68
88445b6436&path=/Core/Source/Autofac.Integration.Mvc/AutofacDependencyResolver.c
s

Please provide any additional information below.

The issue is that there is no registration for the AutofacDependencyResolver so 
when the AutofacFilterProvider calls AutofacDependencyResolver.Current this 
returns null. By adding the line: 
builder.RegisterType<AutofacDependencyResolver>().AsSelf(); to our global asax 
we are able to fix the problem. It looks like the registration has been added 
to the AutofacDependencyResolver.RequestLifetimeScope property but in our 
project this is not called for any reason so it is never wired up.

Original issue reported on code.google.com by james.hu...@gmail.com on 15 Dec 2013 at 10:27

GoogleCodeExporter commented 8 years ago

Original comment by travis.illig on 16 Dec 2013 at 3:51

GoogleCodeExporter commented 8 years ago
Moved issue to GitHub: https://github.com/autofac/Autofac/issues/479

Subsequent issue management will be held there; closing the issue on Google 
Code as "WontFix" because we will handle issue resolution on GitHub.

Original comment by travis.illig on 11 Feb 2014 at 12:01