'0' is not a valid integer number?

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Joris Koster - Paragon Decision Technology
Version: 3.1.0217
Platform: .NET 2.0
Environment: Windows XP (32-bit)
Avatar
Recently we received a bug report from a customer that we're not able to reproduce, but sounds like it is an issue with the SyntaxEditor.

The customer send us a screenshot
of the error box. The bit of XML at 257,18 is:
<RegexPatternGroup TokenKey="DefaultToken" TokenID="0" PatternValue="({LineTerminatorWhitespaceMacro})+" IsWhitespace="True" />
although this a bit relic code (from the days we we're using C++ in combination with the editor and therefore (C#) enums were not an option), we never had a customer with the same problem.

I'm about to go through my language definition/code and remove/replace the hard coded values by nice enums hoping that will solve the problem. But since this problem hasn't occurred with any other customer I'm curious what the underlying problem is.

The customer has quite strict security settings and has a company customized version of .NET 2.0; we're guessing in the direction of a different version of MSXML or ...

Comments (4)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Joris,

That code should work fine. This is the snippet of code where that particular loading occurs. Note that we have to support .NET 1.1, which is why we don't use int.TryParse instead. But I don't see anything wrong with your input or our code. Do you?
string tokenID = reader.GetAttribute("TokenID");
if (tokenID != null) {
    try {
        lexicalPatternGroup.TokenID = int.Parse(tokenID.Trim());
    }
    catch {
        this.ThrowException(language, reader, String.Format("The regex pattern group for token '{0}' contains a token ID '{1}' that is not a valid integer number.", tokenKey, tokenID));
    }
}
[Modified at 03/05/2007 06:27 AM]


Actipro Software Support

Posted 12 years ago by Joris Koster - Paragon Decision Technology
Avatar
No I don't see anything wrong either, once again it also strange that only 1 person / computer at that specific site (i.e. more persons have the same scripted .NET versions etc.) is having trouble with this.

Right now the only things that I can figure is that Parse throws an exception (since Trim() doesn't throw exceptions and never returns a null ptr ... according to the documentation). This exception is in that case most likely a FormatException (I don't believe overflowing could be a problem here), leading me to believe that it is a problem with some customized Regional/Language setting, or resulting from that.

I've emailed the customer a tiny program that tries to convert the string "0" into an integer using 'int.Parse' and displaying the exception (if any).

It might be an idea (for the syntax editor) to propagate/store the original exception in the new exception as well, such that the exact underlying exception is shown.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Good idea, that is implemented for the next maintenance release.


Actipro Software Support

Posted 12 years ago by Joris Koster - Paragon Decision Technology
Avatar
OK, the customer had his IT dept dump a fresh ghost-image on his computer but the problem remained; after a while it turned out that not only our software was having problems. Finally the IT dept of that company decided to completely erase/reinitialize his account. Afterwards (with his new account) the problem was gone! :)

No clue to whatever misconfiguration or even bad .NET install he previously had that caused the '0' is not a valid integer number.

Well, the good thing is, I finally got rid of the hardcoded values :)
The latest build of this product (v2018.1 build 0341) was released 7 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.