FIX: System.FormatException when you run a Visual Studio 2010 application that calls the DataSet.ReadXmlSchema method

Symptoms

Consider the following scenario:

  • You run an application that is created by using Microsoft Visual Studio 2010.

  • You call the DataSet.ReadXmlSchema method to read an XML schema into a DataSet object.

  • You set the Negative sign symbol setting to a symbol other than the minus sign ("-") in the Number tab of the Customize Format dialog box.

    Note The Customize Format dialog box is in the Regional and Language settings of the computer.

In this scenario, the application encounters a System.FormatException exception and then crashes. Additionally, you may receive the following error message and stack trace information if you try to debug the application:

Input string was not in a correct format.

StackTrace:

at System.Number.StringToNumber()

at System.Number.ParseInt32()

at System.String.System.IConvertible.ToInt32()

at System.Convert.ChangeType()

at System.Data.XSDSchema.HandleElementColumn()

at System.Data.XSDSchema.HandleParticle()

at System.Data.XSDSchema.HandleComplexType()

at System.Data.XSDSchema.InstantiateTable()

at System.Data.XSDSchema.HandleTable()

at System.Data.XSDSchema.LoadSchema()

at System.Data.DataSet.InferSchema()

at System.Data.DataSet.ReadXmlSchema()

at System.Data.DataSet.ReadXmlSchema()

at WindowsFormsApplication2.Form1.button1_Click()

Cause

This issue occurs because of a hardcoded literal "-1" string in the XSDSchema.HandleElementColumn method.

Resolution

Hotfix information


A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.



To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=supportNote
In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites


To apply this hotfix, you must have Visual Studio 2010 installed.

Restart requirement

You must restart the computer after you apply this hotfix if the affected file is being used.  

  We recommended that you close all instances of Visual Studio before you apply this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File Information


The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the
Time Zone
tab in the
Date and Time
item in Control Panel.


For the x86-based version of Windows XP and of Windows Server 2003

File name

File version

File size

Date

Time

Platform

System.data.dll

2.0.50727.5653

2,927,616

11-Feb-2011

03:32

x86

For the x64-based version of Windows XP and of Windows Server 2003

File name

File version

File size

Date

Time

Platform

System.data.dll

2.0.50727.5653

3,095,552

10-Feb-2011

21:15

x64

System.data.dll

2.0.50727.5653

2,927,616

11-Feb-2011

03:32

x86

For the IA-64-based version of Windows XP and of Windows Server 2003

File name

File version

File size

Date

Time

Platform

System.data.dll

2.0.50727.5653

3,234,816

10-Feb-2011

21:56

IA-64

System.data.dll

2.0.50727.5653

2,927,616

11-Feb-2011

03:32

x86

For the x86-based version of Windows 7

File name

File version

File size

Date

Time

Platform

System.data.dll

2.0.50727.5653

2,927,616

17-Feb- 2011

23:34

x86

For the x64-based version of Windows 7 and of Windows Server 2008 R2

File name

File version

File size

Date

Time

Platform

System.data.dll

2.0.50727.5653

3,095,552

17-Feb- 2011

23:32

x64

For the IA-64-based version of Windows Server 2008 R2

File name

File version

File size

Date

Time

Platform

System.data.dll

2.0.50727.5653

3,234,816

17-Feb- 2011

23:25

IA-64

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

Thank you for your feedback!

×