Something that would be just as useful as knowing why the above happens, or a workaround for it, would be some help in reflecting RenderPartial.
By using Reflector I find that RenderPartial calls RenderPartialInternal under the hood.
The line in RenderPartialInternal that does the work is:
FindPartialView(engine, viewContext, partialViewName).Render(viewContext, this.ViewContext.HttpContext.Response.Output);
So what I need to see is Render... however because FindPartialView returns an IView Reflector just gives me the method signature for IView:
void Render(ViewContext viewContext, TextWriter writer);
Not very helpful, but that's OK, because I can go into FindPartialView to find out what the actual type is that's implementing IView and look at the Render method there, right?
ViewEngineResult result = engine.FindPartialView(viewContext, partialViewName);
if (result.View != null)
{
return result.View;
}
So now I know to go to ViewEngineResult and see what type it's View property is so I can find the code for that Render method above...
public IView View
{
[CompilerGenerated]
get
{
return this.k__BackingField;
}
private [CompilerGenerated]
set
{
this.k__BackingField = value;
}
}
...and now I'm officially out of my depth
These are auto-generated properties right? Like:
public string something { get; set; }
So the View property is getting set somewhere else? Anyone familiar with the MVC source and knows what is going on here? Or do I have to *sigh* decompile and step through? I can see that being a bit of a headache, sometimes Reflector doesn't decompile properly and I don't know if I'm up to fixing it if that happens