Re: Very strange "input string not in correct format" bug



Well, the trick of changing locale to something else and then back again did
fix the problem. I hope Microsoft can eventually find and fix this! It
will be interesting to see how many users of our app. have this problem once
the app. is released. At least we have an easy "fix" now to tell them.


"Jen" <none@xxxxxxxxxxx> wrote in message
news:ucjHptLYHHA.4560@xxxxxxxxxxxxxxxxxxxxxxx
I can't really do a detailed analysis of the differences because the
offending machine is not accessible to me at the moment.

What the code is doing is it's taking a string from a TextBox that is part
of a User Control and converting it to a short. The exception's trace
looks something like this:

System.Number.StringToNumber()
System.Number.ParseInt32()
System.Number.Int16.Parse()
Util.IPAddressBox.get_Octet3() <-- this is an Int16 property in my user
control

I'm not sure why the call to ParseInt32 is there but I guess that's the
way it works. I've also seen the exception happen with textboxes that
convert right to Int32 instead of Int16. They are also accessed through a
property of a user control.


I am having the guy that owns the machine try the "set locale to something
else then back again to English (US)" trick that someone mentioned to see
if that fixes it. If it does not I'll pursue additional debugging.


"Laura T." <LT@xxxxxxxxxxx> wrote in message
news:eKdCTELYHHA.596@xxxxxxxxxxxxxxxxxxxxxxx
What diffrences have the machines that generate exception?
Framework version, hot fixes, OS fixes, UI language/culture etc.?
I tried to reproduce the exception by setting the thread culture to all
possibile cultures I have (158) but did not get any exception from
Convert.ToInt16("172").
The only thing I cannot test that could have something to do with
cultures are the UI cultures but, I'd rather check first what are the
differences.


"Jen" <none@xxxxxxxxxxx> ha scritto nel messaggio
news:%233ZUVgCYHHA.4520@xxxxxxxxxxxxxxxxxxxxxxx
One user of my application is experiencing an exception "input string
not in correct format". But it makes no sense where it is occurring.
It is occurring when a string from a textbox ("172") is being convert to
an Int16 (using Convert.ToInt16). How can that be? There are other
text boxes that are used in the identical fashion and they don't
generate the exception. All there are many other machines running my
application that don't generate the exception at all.

I have no idea what the problem could be and am looking for ideas.







.



Relevant Pages

  • Re: Checking for null parameter
    ... it throw a checked exception? ... How can you fix what you can't detect? ... before calling a method? ... Isn't this the same thing as if a NPE was thrown? ...
    (comp.lang.java.programmer)
  • RE: CheckSuspiciousPhysicalPath issue in ASP.Net Framework 1.1 SP1 fix
    ... This fix is included ... An unhandled exception occurred during the execution of the ... > current web request. ... > Char[] whitespaceChars, Char directorySeparator, Char altDirectorySeparator, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Exceptions RPC_S_UNKNOWN_IF
    ... closer to actual release, I'm trying to weed out all of the bugs that I can ... But would like an actual fix... ... Is this exception only happen after ever few thousand ... >>> Arkady ...
    (microsoft.public.win32.programmer.networks)
  • Re: Cannot add user to WSS3
    ... Even if the fix is tedious, ... is to stsadm -o export each site, sub site and sub sub site and so on, ... Delphi Technology Solutions ... Exception Occurred. ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Very strange "input string not in correct format" bug
    ... of a User Control and converting it to a short. ... Framework version, hot fixes, OS fixes, UI language/culture etc.? ... I tried to reproduce the exception by setting the thread culture to all ... The only thing I cannot test that could have something to do with cultures ...
    (microsoft.public.dotnet.languages.csharp)