FIX: You receive a "System.ExecutionEngineException" exception when your application deserializes a hash table in the .NET Framework 1.1 SP1 (889168)



The information in this article applies to:

  • Microsoft .NET Framework 1.1 Service Pack 1 (SP1)

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: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 "Applies to" section.

MORE INFORMATION

Steps to reproduce the behavior

  1. Start Microsoft Visual Studio .NET 2003.
  2. On the File menu, point to New, and then click Project.
  3. Click Visual C# Projects, click Console Application, and then click OK.
  4. In Solution Explorer, right-click References, and then click Add Reference.
  5. On the .NET tab, click System.Runtime.Serialization.Formatters.Soap, click Select, and then click OK.
  6. 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("q17P","1");
    			C2.questionStmtMap.Add("q107","2");
    			string filename = @"Test.bin";
    			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 ); 
    			}
    
    		}
    		
    	}
    }
  7. On the Debug menu, click Start. You will receive the exception that is mentioned in the "Symptoms" section.
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


Modification Type:MinorLast Reviewed:6/5/2006
Keywords:kbHotfixServer kbQFE kbfix kbbug KB889168 kbAudDeveloper