1

Closed

CreateInstance DependencyResolver in PrecompiledMvcEngine

description

Line 141 causing a null exception when our CastleWindsor IDependencyResolver returns null for GetService() resolution of _ViewStart, and _AreaLayout et al.

Adding a null-coalescing operator to the DependencyResolver.Current.GetService(type) call can avoid the issue:

return DependencyResolver.Current.GetService(type) ?? Activator.CreateInstance(type);
Closed Apr 26, 2013 at 7:53 PM by davidebbo
Thanks odinserj for making this change!

comments

odinserj wrote Apr 26, 2013 at 3:49 PM

tawman wrote Apr 26, 2013 at 4:17 PM

I agree that changeset has resolved this item with the implementation of the new RazorGenerator.Mvc/DefaultViewPageActivator.cs

I have not tested this out for our implementation, but my code review aligns with my recommendation.

Thanks.