AccessViolationException in OpenFileDialog.ShowDialog()

Note to self:  Next time I get this error, when running in a 64-bit OS, make sure to specify x86 for Platform target in the Build options.


Good tips from Eilon Lipton on this error:

Microsoft Internet Explorer
Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

I suppose I fell into trap #5 listed on the article.  I was looking to do parameter passing from the current page to the redirected page. Basically, I had a general “catch all” event handler that catches unhandled exception, and forwards the detail to an error display page.  There doesn’t seem to be any direct way of passing parameters from one  .aspx page to another. So I stuffed this parameter into the HttpContext object.  The problem is: Reponse.Redirect() wipes out all parameters stored in the context. This problem doesn’t happen if I use Server.Transfer().

All of this was happening inside an UpdatePanel,  just as Eilon explained.  Hence, the PageRequestManagerParserErrorException. I looked in my ErrorStack, saw what the originating error was, fixed it, and the PageRequestManagerParserErrorException was gone.

I guess the next step would be to figure out how to display the error properly when invoked from an UpdatePanel, as it is working well everywhere else.