Last post Jan 22, 2015 06:51 AM by AidyF
Jan 21, 2015 05:36 PM|wavemaster|LINK
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
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.
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" %>
2) Add the following section to the configuration file of your application:
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.
[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
System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +69
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +116AND 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,
Jan 22, 2015 06:51 AM|AidyF|LINK
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.