I am also having a similar problem. I have a simple site using a masterpage in the same directory as the affected page. Closing/restarting VS cures this for a random period of time. Sometimes hours, sometimes minutes. There have been cases where I load the editor, make a small tweak to the codebehing on a completely different page, and start debugging. My error does not reference the masterpage:
"Unable to cast object of type 'ASP.info_parameters_aspx' to type 'ASP.info_parameters_aspx'."
The line of code causing this error is in the codebehind:
if (!PreviousPage.IsValid)
Detailed exception error:
System.InvalidCastException was unhandled by user code
Message="Unable to cast object of type 'ASP.info_parameters_aspx' to type 'ASP.info_parameters_aspx'."
Source="App_Web_f27gonji"
StackTrace:
at MemberResultsList.get_PreviousPage() in c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\phc\cfa5ec36\a10de74\App_Web_f27gonji.0.cs:line 0
at MemberResultsList.Page_Load(Object sender, EventArgs e) in c:\dev\Data\WebSites\PHC\info\MemberResultsList.aspx.cs:line 20
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)