[Mono-aspnet-list] Input string was not in the correct format

Mark DevGood dirkroel at gmail.com
Mon Nov 23 16:08:23 EST 2009

I'd like to post the solution to a bug that seriously had me scratching my
head. This may be answered already but I could not easily find the solution
to this on the web and had to resort to a painstaking process to discover
the issue.

If you see this error message:

System.FormatException: Input string was not in the correct format
  at System.Int32.Parse (System.String s, NumberStyles style,
IFormatProvider provider) [0x00000] 
  at System.Web.UI.WebControls.WebColorConverter.ConvertFrom
(ITypeDescriptorContext context, System.Globalization.CultureInfo culture,
System.Object value) [0x00000] 

The solution is to hunt for a asp control which has a property such as
ForeColor="Red", then removing this solves the problem. 

Example which gives the error:  
<asp:Label ID="lblMessage" runat="server" Text="" Visible="true"
Font-Bold="true" ForeColor="Red" />

Example which works okay: 
<asp:Label ID="lblMessage" runat="server" Text="" Visible="true"
Font-Bold="true" />

Now I don't mind the fact that "Red" may not be supported as a colour,
however the part I find extremely painful is that the error message shown
does not tell me ANYTHING about where to hunt for the problem. 
We need to have a better error message for this so that developers don't
need to comment out lines of code one by one to see if the problem is

I'd much appreciate it if a kind soul could log this as a bug as I do not
have a login for Novell.
View this message in context: http://old.nabble.com/Input-string-was-not-in-the-correct-format-tp26485849p26485849.html
Sent from the Mono - ASP.NET mailing list archive at Nabble.com.

More information about the Mono-aspnet-list mailing list