Microsoft KB Archive/889168

= FIX: You receive a &quot;System.ExecutionEngineException&quot; exception when your application deserializes a hash table in the .NET Framework 1.1 SP1 =

Article ID: 889168

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.1 Service Pack 1

-





SYMPTOMS
In the Microsoft .NET Framework 1.1 Service Pack 1 (SP1), when your application deserializes a hash table, you receive the following exception:

System.ExecutionEngineException



CAUSE
This problem occurs because the hash table is serialized with the CaseInsensitveComparer class. The CaseInsensitveComparer class calls the CompareInfo class. Because deserialization does not guarantee the order of deserialization, the CaseInsensitveComparer class is deserialized before the CompareInfo class is deserialized. The CaseInsensitveComparer class calls the Compare method of the CompareInfo class. However, the CompareInfo class has not initialized its data structures correctly at this point. Therefore, you receive the exception.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

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

http://support.microsoft.com/contactus/?ws=support

Note 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.

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 tool in Control Panel.

  Date         Time   Version        Size       File name --  17-Nov-2004  07:57  1.1.4322.2048  2,138,112  Mscorlib.dll 16-Nov-2004 04:20                    10,880  Mscorlib.ldo 16-Nov-2004 04:28  1.1.4322.2048  2,514,944  Mscorsvr.dll 16-Nov-2004 04:29  1.1.4322.2048  2,506,752  Mscorwks.dll



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the behavior
 Start Microsoft Visual Studio .NET 2003. On the File menu, point to New, and then click Project. Click Visual C# Projects, click Console Application, and then click OK. In Solution Explorer, right-click References, and then click Add Reference. On the .NET tab, click System.Runtime.Serialization.Formatters.Soap, click Select, and then click OK.</li>  In Solution Explorer, double-click Class1.cs, and then replace all the code that is provided in Class1.cs with the following code example. using System; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters; using System.IO; using System.Runtime.Serialization.Formatters.Soap; using System.Collections;

namespace ConsoleApplication1 {   [Serializable] public class Class2 {       public Hashtable questionStmtMap = new Hashtable(new CaseInsensitiveHashCodeProvider, new CaseInsensitiveComparer); public Class2 {

}

}

class Class1 {       [STAThread] static void Main(string[] args) {           Class2 C2 = new Class2; object o = new object; C2.questionStmtMap.Add(&quot;q17P&quot;,&quot;1&quot;); C2.questionStmtMap.Add(&quot;q107&quot;,&quot;2&quot;); string filename = @&quot;Test.bin&quot;; SoapFormatter formatter = new SoapFormatter; formatter.AssemblyFormat = FormatterAssemblyStyle.Simple; using(Stream stream = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.Write)) {                formatter.Serialize(stream, C2); }

using(Stream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) {               //The application will fail at the next line with a System.ExecutionEngineException exception. C2 = (Class2) formatter.Deserialize( stream, null ); }

}   } } </li> On the Debug menu, click Start. You will receive the exception that is mentioned in the &quot;Symptoms&quot; section.</li></ol>

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

Keywords: kbhotfixserver kbqfe kbfix kbbug KB889168

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.