System.TypeLoadException while executing any .Net Framework 2.0 application


You may find any .Net 2.0 application crashes with an error message "setup.exe has encountered a problem and needs to close"

You may also find the following error message in the Application Event log: EventType clr20r3, P1 <application name>, P2 6.0.3790.1830, P3 42435be1, P4 app_web_7437ep-9, P5 0.0.0.0, P6 433b1670, P7 9, P8 a, P9 system.exception, P10 NIL.

We found that the .Net Framework 2.0 verification tool (http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog%7C_Tools/netfx%7C_setupverifier%7C_new.zip) reported the below failure as well:

 

[02/13/13,09:59:31] Launching process 'Netfx20TestApplication.exe' now

[02/13/13,09:59:31] Process successfully launched. Waiting 300 seconds for it to complete.

[02/13/13,09:59:53] ****ERROR**** Process 'Netfx20TestApplication.exe' exited with return code -532459699

[02/13/13,09:59:53] Section [Files - .NET Framework netfxperf.dll] - start parsing entries

[02/13/13,09:59:53] File C:\WINDOWS\system32\netfxperf.dll (version 1.1.4322.573) is installed on the system

[02/13/13,09:59:53] Section [Files - .NET Framework netfxperf.dll] - stop parsing entries

[02/13/13,09:59:53] ****ERROR**** Verification failed for product .NET Framework 2.0

 

We launched the sample.Net 2.0 application in debugger ( http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx) and found the below exception and root cause of the failure:

 

0:000> k

*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll -

ChildEBP RetAddr 

WARNING: Stack unwind information not available. Following frames may be wrong.

0012d8ac 79f55b05 KERNEL32!RaiseException+0x3c

0012d90c 7a056a79 mscorwks!DllGetClassObjectInternal+0x27dad

0012d948 7a056b30 mscorwks!GetAddrOfContractShutoffFlag+0xa7d3

0012d974 7a056b41 mscorwks!GetAddrOfContractShutoffFlag+0xa88a

0012da70 79e7b29b mscorwks!GetAddrOfContractShutoffFlag+0xa89b

0012daa0 79e9c9c0 mscorwks!DllRegisterServerInternal+0xe17

0012daa4 79e9c991 mscorwks!CoUninitializeEE+0x179a4

0012daac 79e82ef6 mscorwks!CoUninitializeEE+0x17975

0012daf4 79e82eac mscorwks!DllRegisterServerInternal+0x8a72

0012db3c 79ee16d2 mscorwks!DllRegisterServerInternal+0x8a28

0012db7c 79eee5d1 mscorwks!StrongNameErrorInfo+0x403

0012db80 79eee5a5 mscorwks!StrongNameErrorInfo+0xd302

0012db90 79eee5c2 mscorwks!StrongNameErrorInfo+0xd2d6

0012dc14 7c87c34b mscorwks!StrongNameErrorInfo+0xd2f3

0012dc84 7c854f44 ntdll!RtlpNtMakeTemporaryKey+0x897f

0012dc90 7c83dbea ntdll!RtlIpv4StringToAddressExW+0x1377e

0012dcb4 79e787b7 ntdll!RtlSubAuthorityCountSid+0x413

0012dd10 79ee3707 mscorwks!LogHelp_TerminateOnAssert+0x39f

0012dd28 79e8837d mscorwks!StrongNameErrorInfo+0x2438

0012dd3c 79e86e2f mscorwks!CoUninitializeEE+0x3361

 

0:000> !pe

PDB symbol for mscorwks.dll not loaded

Exception object: 01258510

Exception type: System.TypeLoadException

Message: Failure has occurred while loading a type.

InnerException: <none>

StackTrace (generated):

    SP       IP       Function

    00000000 00000001 System.Environment.GetResourceFromDefault(System.String)

    0012EC4C 03DB4E91 System.Reflection.TargetInvocationException..ctor(System.Exception)

    00000000 00000001 System.RuntimeTypeHandle.CreateInstance(System.RuntimeType, Boolean, Boolean, Boolean ByRef, System.RuntimeMethodHandle ByRef, Boolean ByRef)

    0012F418 033764AD System.Activator.CreateInstance[[System.__Canon, mscorlib]]()

    0012F434 03376276 WinApp2._0.My.MyProject+ThreadSafeObjectProvider`1[[System.__Canon, mscorlib]].get_GetInstance()

    0012F450 033761C1 WinApp2._0.My.MyProject.get_Application()

    0012F45C 03374253 WinApp2._0.My.MyApplication.Main(System.String[])

 

StackTraceString: <none>

HResult: 80131522

 

0:000> !do 01258510

Name: System.TypeLoadException

MethodTable: 03da50a4

EEClass: 03d74f34

Size: 88(0x58) bytes

(C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)

Fields:

      MT    Field   Offset                 Type VT     Attr    Value Name

00929350  40000b5        4        System.String  0 instance 00000000 _className

03366b2c  40000b6        8 ...ection.MethodBase  0 instance 00000000 _exceptionMethod

00929350  40000b7        c        System.String  0 instance 00000000 _exceptionMethodString

00929350  40000b8       10        System.String  0 instance 0125627c _message

0336a1e8  40000b9       14 ...tions.IDictionary  0 instance 00000000 _data

010d1254  40000ba       18     System.Exception  0 instance 00000000 _innerException

00929350  40000bb       1c        System.String  0 instance 00000000 _helpURL

00926cf0  40000bc       20        System.Object  0 instance 0125b8ec _stackTrace

00929350  40000bd       24        System.String  0 instance 00000000 _stackTraceString

00929350  40000be       28        System.String  0 instance 00000000 _remoteStackTraceString

03367e40  40000bf       34         System.Int32  0 instance        0 _remoteStackIndex

00926cf0  40000c0       2c        System.Object  0 instance 00000000 _dynamicMethods

03367e40  40000c1       38         System.Int32  0 instance -2146233054 _HResult

00929350  40000c2       30        System.String  0 instance 00000000 _source

010d9930  40000c3       3c        System.IntPtr  0 instance        0 _xptrs

03367e40  40000c4       40         System.Int32  0 instance -532459699 _xcode

00929350  4000397       44        System.String  0 instance 00000000 ClassName

00929350  4000398       48        System.String  0 instance 00000000 AssemblyName

00929350  4000399       4c        System.String  0 instance 00000000 MessageArg

03367e40  400039a       50         System.Int32  0 instance        0 ResourceId

 

0:000> !do 0125627c

Name: System.String

MethodTable: 00929350

EEClass: 00a4184c

Size: 102(0x66) bytes

(C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)

String: Failure has occurred while loading a type.

Fields:

      MT    Field   Offset                 Type VT     Attr    Value Name

03367e40  4000096        4         System.Int32  0 instance       43 m_arrayLength

03367e40  4000097        8         System.Int32  0 instance       42 m_stringLength

010d0010  4000098        c          System.Char  0 instance       46 m_firstChar

00929350  4000099       10        System.String  0   shared   static Empty

   >> Domain:Value  0014cd90:01251374 <<

010d6fc8  400009a       14        System.Char[]  0   shared   static WhitespaceChars

    >> Domain:Value  0014cd90:01251388 <<

 

0:000> lmvm mscorlib

start    end        module name

790c0000 79500000   mscorlib   (deferred)            

    Image path: C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll

    Image name: mscorlib.dll

    Has CLR image header, track-debug-data flag not set

    Timestamp:        Tue Oct 23 23:30:35 2007 (471EBC5B)

    CheckSum:         00444046

    ImageSize:        00440000

    File version:     2.0.50727.1433

    Product version:  2.0.50727.1433

    File flags:       0 (Mask 3F)

    File OS:          4 Unknown Win32

    File type:        2.0 Dll

    File date:        00000000.00000000

    Translations:     0409.04b0

    CompanyName:      Microsoft Corporation

    ProductName:      Microsoft® .NET Framework

    InternalName:     mscorlib.dll

    OriginalFilename: mscorlib.dll

    ProductVersion:   2.0.50727.1433

    FileVersion:      2.0.50727.1433 (REDBITS.050727-1400)

    FileDescription:  Microsoft Common Language Runtime Class Library

    LegalCopyright:   © Microsoft Corporation.  All rights reserved.

    Comments:         Flavor=Retail

 

 

0:000> lmvm mscorwks

start    end        module name

79e70000 7a3d6000   mscorwks   (export symbols)       C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll

    Loaded symbol image file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll

    Image path: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll

    Image name: mscorwks.dll

    Timestamp:        Fri Apr 13 03:15:54 2007 (461F2E2A)

    CheckSum:         0056BC8E

    ImageSize:        00566000

    File version:     2.0.50727.832

    Product version:  2.0.50727.832

    File flags:       0 (Mask 3F)

    File OS:          4 Unknown Win32

    File type:        2.0 Dll

    File date:        00000000.00000000

    Translations:     0409.04b0

    CompanyName:      Microsoft Corporation

    ProductName:      Microsoft® .NET Framework

    InternalName:     mscorwks.dll

    OriginalFilename: mscorwks.dll

    ProductVersion:   2.0.50727.832

    FileVersion:      2.0.50727.832 (QFE.050727-8300)

    FileDescription:  Microsoft .NET Runtime Common Language Runtime - WorkStation

    LegalCopyright:   © Microsoft Corporation.  All rights reserved.

    Comments:         Flavor=Retail

 

The binary mscorlib.dll version 2.0.50727.1433 was loaded from GAC where loaded mscorwks.dll version was 2.0.50727.832. So there were mismatch version of CLR binaries. Both the files should be at the same level. Hence, we renamed the existing mscorlib.dll at C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll and added the mscorlib.dll version 2.0.50727.832 to GAC from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727.  Both the binaries were at the same level and we were  able to run the sample .Net 2.0 application successfully. Another  solution would be to install the .Net Framework 2.0 SP2 http://www.microsoft.com/en-us/download/details.aspx?id=1639 to upgrade all the core binaries.


Comments (0)

Skip to main content