开发者

Why is my server side exception not causing my code to break in VS2010?

I'm开发者_Python百科 running an ASP.NET project on IIS locally, and an exception is getting reported back to the web browser after a postback has been handled.

In VS2010, if I look at Debug->Exceptions..., every exception type is checked to break when thrown.

Here's the exception I'm seeing in my browser popup:

Line: 868 Error: Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format.

Here's the response back to the browser I got from Fiddler:

41|error|500|Input string was not in a correct format.|

Of course I googled, and most posts say that attempting to parse a string to an int can cause this. I don't think I'm doing anything like that.

======Edit=======

Removed updatepanel, and now I get:

[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +12630469
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +224
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +483
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3691

=================

thanks, Mark


Problem was that for a button I had in my grid, I was setting the CommandArgument, which I should not be doing. This is used by the GridView to get the row index in case it doesn't have the actual row owning the button.


The exception is happening before your code is even invoked. Maybe this? Sys.WebForms.PageRequestManagerServerErrorException 12031


I don't know about breaking your debugger. By default, this type of error won't break your code. You should have a proper try{}catch{} statement setup for the code that handles your data manipulation. You could even have some debug variables that you could output in your catch{} to help you locate your error if your dealing with lots of data. Run your debugger and iterate through it to find the error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜