In Visual Studio 2005, the following throws a FormatException and it definitely shouldn't. The same code works fine in Visual Studio 2003.
This is the version that I am seeing the problem, running on XP:
Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727
Installed Edition: Professional
int x = 0;
x = Int32.Parse("0") // throws FormatException
x = Int32.Parse("00") // works fine
x = Int32.Parse("000") // works fine
x = Int32.Parse("0000") // works fine

bug in Int32.Parse
Nagarajan
This probably got past their QA because it's working fine against their tests (along with the two people in this thread who couldn't repro it either.) I suspect a bug report might easily get dismissed as no-repro based on the information you are able to give them. Hopefully someone else in this forum can come up more troubleshooting ideas so you can get to the bottom of it.
Also, if you think the exact condition for this exception to occur is only on "0," then you have a workaround (which is obvious.)
Brian
Harini
I'm hoping someone using the same version (we downloaded the iso from MSDN last week) will be able to reproduce the problem. I can't find anywhere to report a bug without starting a support incident, which seems a bit extreme.
This kind of bug will keep our team from switching over from VS2003 to VS2005. If this got through QA, I don't want to know what else slipped by.
M. R. Miller
Thanks,
Kevin
By the way, another problem that must be related to this also pops up when you try and modify the Assembly Information through the new graphical UI in the IDE. If you try and modify the Assembly Version and put zeroes in for any of the values (major, minor, revision, build), a dialog pops up saying:
Each part of the version number for 'Assembly Version' must be an integer between 0 and 65534.
It also happens for File Version on the same dialog.
If the values are already zeroes when populating the dialog, hitting OK won't exhibit the problem, you have to change one of the values first.
rjschave
You didn't by any chance have an earlier beta on the same PC, did you
There's definitely something weird going on there!
Miccysoft
Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727
Installed Edition: Professional
Dare Obasanjo - MSFT
Brian
Pascal Deliot
Srikanth Bogadapati
namespace IntParse
{
class Program
{
static void Main(string[] args)
{
int x = Int32.Parse("0");
}
}
}
Jacky Chau
GAINSCOM
My assembly.cs has:
[assembly:
AssemblyCulture("")]Under Control Panel->Regional and Language Options, I'm set to English(United States), but it would be tidious to compare every setting below that (I've never touched this.)
Brian
Federico Provera
Workcover
static void Main(string[] args)
{
int x1, x2, x3, x4;
x1 = Int32.Parse("0"); // works fine
x2 = Int32.Parse("00"); // works fine
x3 = Int32.Parse("000"); // works fine
x4 = Int32.Parse("0000"); // works fine
}
Ning
Is there a colleague machine where you can install the same ISO, preferably a clean machine (maybe you can bother the receptionist! :) ), type up the test case from scratch, and see if it reproduces the problem
Brian
Marshall Moorman
On one system I tested a side by side install of VS2003 and VS2005, on the other system I uninstalled VS2003 and all .net framework installs before installing VS2005.