开发者

What causes the type initializer for 'System.Management.MTAHelper' to throw an exception

...and how to resolve it?

The is thrown from 32bit .Net app that is run on a 64bit Windows.

The machine has the require .Net framework installed.

Mozi开发者_JAVA技巧lla/4.0(compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .Net CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)

EDIT: Here's the inner exception

Exception Source: System.Management

Exception Type: System.Runtime.InteropServices.COMException

Exception Message: Retrieving the COM class factory for component with CLSID {A8F03BE3-EDB7-4972-821F-AF6F8EA34884} failed due to the following error: 80040154.

Exception Target Site: .cctor


There's an MSDN post that reports the same problem, with a solution:

So I went to HKCR\CLSID{A8F03BE3-EDB7-4972-821F-AF6F8EA34884}\InprocServer32(Default) in my x64 environment, and saw the following path: C:\Windows\system32\mscoree.dll.

Customer changed the C:\WINDOWS\SysWOW64\mscoree.dll path he found in there to the right one, and he didn't get the error again.

There's no explanation given for why the path might be wrong, but it seems it worked... you could at least check that registry setting and see whether it looks wrong on the box in question.


I just solved it! I had to reinstall .NET 1.1 on windows 7. Here is how:

Downloaded: http://www.microsoft.com/Downloads/details.aspx?FamilyId=262D25E3-F589-4842-8157-034D1E7CF3A3&displaylang=en Downloaded: http://www.microsoft.com/downloads/details.aspx?FamilyID=a8f5654f-088e-40b2-bbdb-a83353618b38&displaylang=en

Then:

mkdir c:\dotnetfx
c:\DotNet
dotnetfx.exe /T:c:\dotnetfx /C
c:\dotnetfx\msiexec.exe /a netfx.msi TARGETDIR=C:\DotNet
NDP1.1sp1-KB867460-X86.exe /Xp:C:\DotNet\netfxsp.msp
msiexec.exe /a c:\DotNet\netfx.msi /p c:\DotNet\netfxsp.msp
C:\DotNet\netfx.msi


It's hard to say without further details, but when you get a TypeInitializationException, check the InnerException, it usually contains the underlying reason.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜