locked
troubleshooting a mobile only exception RRS feed

  • Question

  • User379720387 posted

    Application works fine on desktops, today I was demoing the app on a Galaxy S4 and I get an system.formatexception.

    Looking for suggestions on how to troubleshoot this.

    I do have debug="true".

    I know which file this happened in but I have no clue where in the file it happened or why it would only happen on a mobile device.

    Any insights would be appreciated.

    Web Pages w Razor C, on Azure

    Galaxy S4

    Input string was not in a correct format.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.FormatException: Input string was not in a correct format.

    Source Error:

    The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

    1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

      <%@ Page Language="C#" Debug="true" %>

    or:

    2) Add the following section to the configuration file of your application:

    <configuration>
       <system.web>
           <compilation debug="true"/>
       </system.web>
    </configuration>

    Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

    Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.


    Stack Trace:

    [FormatException: Input string was not in a correct format.]
       System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +11013491
       System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +145
       System.Int16.Parse(String s, NumberStyles style, NumberFormatInfo info) +32
       System.String.System.IConvertible.ToInt16(IFormatProvider provider) +46
       System.Convert.ToInt16(Object value) +28
       ASP._Page_Members_EntryF_cshtml.Execute() +1110
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198
       System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +69
       System.Web.WebPages.WebPage.ExecutePageHierarchy() +131
       System.Web.WebPages.StartPage.RunPage() +17
       System.Web.WebPages.StartPage.ExecutePageHierarchy() +64
       System.Web.WebPages.StartPage.RunPage() +17
       System.Web.WebPages.StartPage.ExecutePageHierarchy() +64
       System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
       System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +116

    AND FROM Elmah:
    HTTP_CACHE_CONTROL:max-age=0 HTTP_CONNECTION:Keep-Alive HTTP_VIA:HTTP/1.1 artnz03msp3ts09.wnsnet.attws.com HTTP_ACCEPT:text/html,
    application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_ACCEPT_ENCODING:gzip,deflate,sdch HTTP_ACCEPT_LANGUAGE:en-US,en;q=0.8 HTTP_COOKIE:ASP.NET_SessionId=puxkjhmcmwrllk2jxr1y1u44; __RequestVerificationToken=FSp6fnS-JsQ5UwNRD7OPiiY8U6RKq6JKYhD85-5Bdr1yp_jqhOC96XI7C5s2_EYGKpjrVntB4g-pqoebUeCKeGvsVFpAO6fBw4vopivkiH8xxIKJoEi6q0DoWeCUfQ1CvrqN4xRkqztS6lB-b47cOCBVv0gBrta1BIvl-43MLO81; ARRAffinity=8861359470be3744646f62d7260db44d8404c9e9ed260ca027274cd5ae097076; .ASPXAUTH=B17C3C2E976D0811676AE56FAB3A70F5442F221C840EFDB7B2E04D9F20E3012A364DDC4E4B771089CFEAB4BEA53BA40FB879505F8463D5A2DE306EB7345E99C622C4489890BBE5797CBDA6D908FA12BDB3AC3B3C08E84042E325292D5610CB227E723AC8F3695FE16CB6AA68054861116732C1CCD278C0FC6C2E6C920B7397623F43FDE5B3DFF4CEC15CDD923C2BC143D8827355A0ACEBCD762F32987AFAC22F0FF74B60A240F8A7BD8DE264CEA55C36; _ga=GA1.2.1092757539.1421857644; _gat=1 HTTP_HOST:www.billthis.com HTTP_MAX_FORWARDS:10 HTTP_REFERER:http://www.bt.com/SelectClient HTTP_USER_AGENT:Mozilla/5.0 (Linux; Android 4.4.4; en-us; SAMSUNG-SGH-I337 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36 HTTP_X_WAP_PROFILE:"http://wap.samsungmobile.com/uaprof/SGH-I337.xml" HTTP_X_ATT_DEVICEID:SAMSUNG-SGH-I337/I337UCUFNJ4 HTTP_X_LIVEUPGRADE:1 HTTP_X_ARR_LOG_ID:89c5140a-05da-4ce4-819a-57f7ba5d34d7 HTTP_DISGUISED_HOST:www.bt.com HTTP_X_SITE_DEPLOYMENT_ID:billthis HTTP_X_ORIGINAL_URL:/FBillPrep HTTP_X_FORWARDED_FOR:166.137.244.91:50712
    Wednesday, January 21, 2015 5:36 PM

Answers

  • User-760709272 posted

    You can enable remote errors to see the actual error, but inside your Page_Members_EntryF view you're converting a string to an int, or short or something like that, and you're just assuming the string can be converted.  This could be due to cultural format differences on the device, maybe it is using "1.000,00" for 1000 and your server code is expecting "1,000.00" for 1000. Or maybe it is sending "1,000" when you expect "1000".  Or maybe the string is empty.  You'll need to do some logging to see exactly what is trying to be converted and code around whatever the problem is.  Put your convert inside a try\catch and in the catch show an error message saying what the text you're trying to convert is.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 22, 2015 6:51 AM