views:

698

answers:

2

I upgraded a MVC1 project to MVC2, now all my calls to RenderPartial are throwing

System.ArgumentNullException: Value cannot be null.

However this does works:

<% Html.RenderPartial("~/Views/Shared/LogOnUserControl.ascx"); %>

And this does not (works in MVC1):

<% Html.RenderPartial("LogOnUserControl"); %>

Did the behavior of RenderPartial change?

+1  A: 

Your call to

<% Html.RenderPartial("LogOnUserControl"); %> 

seems to be working fine otherwise you would be receiving

The partial view 'LogOnUserControl' was not found. The following locations were searched....

Considering that

When Html.RenderPartial() is called with just the name of the partial view, ASP.NET MVC will pass to the partial view the same Model and ViewData dictionary objects used by the calling view template.

and

ArgumentNullException is thrown when a method is invoked and at least one of the passed arguments is a null.

It seems like the Authentication arguments are not being passed properly to LogOnUserControl or maybe you have customised it in someway?

Nicholas Murray
The LogOnUserControl has not been modified in anyway from the Create New Project defaults. This happens with all my partials by the way, not just that one. Again referencing the actual path works just fine.
mxmissile
+1  A: 

Bleh.... found the problem, my project was referencing MVCContrib 1.0, downloaded the latest build and referenced that instead fixed the issue.

mxmissile
When you are 89 years young, lol, you may forget such things. Glad you got sorted out.
Nicholas Murray