TypeLoadException

때때로 ClickOnce Application 경우, Binary Version 관리에 어려움을 겪을 때가 있다. 간혹, 잘못된 version packaging 됨에 따라 TypeLoadException 같은 오류를 만날 수도 있다. Fusion Log 확인해 보면, 아래와 같은 오류 메시지를 출력한다.

 

작업을 수행하지 못했습니다.

바인딩 결과: hr = 0x80070002. 지정된 파일을 찾을 수 없습니다.

 

다음 위치에서 어셈블리 관리자 로드:  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll

다음 실행 파일에서 실행:  C:\Documents and Settings\user\Local Settings\Apps\2.0\4OY0HKEP.MG6\BWRZ440C.JYB\clie..tion_074ec68f6f9bd5dd_0001.0000_2b9c0e62c20843f8\Client.exe

--- 자세한 오류 로그가 아래에 표시됩니다.

 

=== 미리 바인딩된 상태 정보 ===

로그: 사용자 = Test\user1

로그: DisplayName = CommonTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=077d93da315deeea

 (Fully-specified)

로그: Appbase = file:///C:/Documents and Settings/user/Local Settings/Apps/2.0/4OY0HKEP.MG6/BWRZ440C.JYB/clie..tion_074ec68f6f9bd5dd_0001.0000_2b9c0e62c20843f8/

로그: 초기 PrivatePath = NULL

로그: 동적 베이스 = NULL

로그: 캐시 베이스 = NULL

로그: AppName = Client.exe

호출 어셈블리: Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

===

로그: 네이티브 이미지 CommonTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=077d93da315deeea() 바인딩하기 시작합니다.

경고: 일치하는 네이티브 이미지가 없습니다.

 

실제로 Fusion Log로는 해당 Client.exe Application CommonTest.dll 참조하고 있는 , 해당 DLL Load하지 못하는 것으로 보여준다. 이런 경우는 CommonTest.dll 종속성 때문에 종속적인 추가적인 DLL 존재하지 않거나 또는 해당 DLL 자체가 Client Machine 배포되지 않았을 경우에도 유사하게 보여준다. 하지만, 종속적인 추가적인 DLL 존재하지 않아서 문제가 된다면, 해당 종속 DLL 대한 FileNotFoundException 추가적으로 보이거나, 해당 DLL 배포되지 않았다면, Memory Dump에서 FileNotFoundException 확인할 있거나 또는 대상 Directory Check해보면, 권한 등의 오류에 의해서 실제로 DLL 존재하지 못하는 경우도 발생될 있다. 그런데, 간혹, Memory Dump 확인하였을 , TypeLoadException 같은 경우도 발생한다.

 

0:000> !do 0143bf08

Name: System.TypeLoadException

MethodTable: 7994b248

EEClass: 791710b4

Size: 88(0x58) bytes

GC Generation: 0

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

Fields:

      MT    Field   Offset                 Type VT     Attr    Value Name

79330a00  40000b5        4        System.String  0 instance 00000000 _className

7932fe74  40000b6        8 ...ection.MethodBase  0 instance 00000000 _exceptionMethod

79330a00  40000b7        c        System.String  0 instance 00000000 _exceptionMethodString

79330a00  40000b8       10        System.String  0 instance 0143c2a8 _message

7932a35c  40000b9       14 ...tions.IDictionary  0 instance 00000000 _data

79330b94  40000ba       18     System.Exception  0 instance 00000000 _innerException

79330a00  40000bb       1c        System.String  0 instance 00000000 _helpURL

7933061c  40000bc       20        System.Object  0 instance 0143c48c _stackTrace

79330a00  40000bd       24        System.String  0 instance 00000000 _stackTraceString

79330a00  40000be       28        System.String  0 instance 00000000 _remoteStackTraceString

79332c4c  40000bf       34         System.Int32  0 instance        0 _remoteStackIndex

7933061c  40000c0       2c        System.Object  0 instance 00000000 _dynamicMethods

79332c4c  40000c1       38         System.Int32  0 instance -2146233054 _HResult

79330a00  40000c2       30        System.String  0 instance 00000000 _source

793332c8  40000c3       3c        System.IntPtr  0 instance        0 _xptrs

79332c4c  40000c4       40         System.Int32  0 instance -532459699 _xcode

79330a00  4000398       44        System.String  0 instance 0143be28 ClassName

79330a00  4000399       48        System.String  0 instance 0143be64 AssemblyName

79330a00  400039a       4c        System.String  0 instance 00000000 MessageArg

79332c4c  400039b       50         System.Int32  0 instance -2146233054 ResourceId

 

0:000> !do 0143be28

Name: System.String

MethodTable: 79330a00

EEClass: 790ed64c

Size: 60(0x3c) bytes

GC Generation: 0

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

String: CommonTest.FileWrapperClass

Fields:

      MT    Field   Offset                 Type VT     Attr    Value Name

79332c4c  4000096        4         System.Int32  0 instance       22 m_arrayLength

79332c4c  4000097        8         System.Int32  0 instance       21 m_stringLength

793316e0  4000098        c          System.Char  0 instance       43 m_firstChar

79330a00  4000099       10        System.String  0   shared   static Empty

    >> Domain:Value  0015e850:01421198 <<

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

    >> Domain:Value  0015e850:014218f0 <<

 

0:000> !do 0143be64

Name: System.String

MethodTable: 79330a00

EEClass: 790ed64c

Size: 164(0xa4) bytes

GC Generation: 0

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

String: CommonTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=077d93da315deeea

Fields:

      MT    Field   Offset                 Type VT     Attr    Value Name

79332c4c  4000096        4         System.Int32  0 instance       74 m_arrayLength

79332c4c  4000097        8         System.Int32  0 instance       73 m_stringLength

793316e0  4000098        c          System.Char  0 instance       43 m_firstChar

79330a00  4000099       10        System.String  0   shared   static Empty

    >> Domain:Value  0015e850:01421198 <<

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

    >> Domain:Value  0015e850:014218f0 <<

 

메모리 덤프상에서 보면, CommonTest.dll Load되어 있는 것으로 보인다. 하지만, FileWrapperClass 라는 이름의 Class 호출할 , TypeLoadException 발생하는 것을 있다. 경우에는 CommonTest.dll 포함하고 있는 FileWrapperClass load 하지 못하는 경우이다. 일반적으로 해당 Class CommonTest.dll에서 제공하는 것이 맞는 지를 Check하는 것이 일감일 하다.

 

0:000> !dumpdomain

--------------------------------------

. . .

Assembly: 00229cd8 [C:\Documents and Settings\user\Local Settings\Apps\2.0\4OY0HKEP.MG6\BWRZ440C.JYB\clie..tion_074ec68f6f9bd5dd_0001.0000_2b9c0e62c20843f8\CommonTest.dll]

ClassLoader: 0020f0f0

SecurityDescriptor: 001c3060

  Module Name

00ad5c88 C:\Documents and Settings\user\Local Settings\Apps\2.0\4OY0HKEP.MG6\BWRZ440C.JYB\clie..tion_074ec68f6f9bd5dd_0001.0000_2b9c0e62c20843f8\CommonTest.dll

 

0:000> !dumpmodule -mt 00ad5c88

Name: C:\Documents and Settings\user\Local Settings\Apps\2.0\4OY0HKEP.MG6\BWRZ440C.JYB\clie..tion_074ec68f6f9bd5dd_0001.0000_2b9c0e62c20843f8\CommonTest.dll

Attributes: PEFile

Assembly: 00229cd8

LoaderHeap: 00000000

TypeDefToMethodTableMap: 037e325c

TypeRefToMethodTableMap: 037e3378

MethodDefToDescMap: 037e35f8

FieldDefToDescMap: 037e3bdc

MemberRefToDescMap: 037e3ee4

FileReferencesMap: 037e4370

AssemblyReferencesMap: 037e4374

MetaData start address: 03816048 (44216 bytes)

 

Types defined in this module

 

      MT    TypeDef Name

------------------------------------------------------------------------------

00ad6310 0x02000002 CommonTest.FileWrapperClassEx

00ad6c14 0x02000006 CommonTest.xxx

 

Types referenced in this module

 

      MT    TypeRef Name

------------------------------------------------------------------------------

7933061c 0x01000001 System.Object

7b21d954 0x01000003 System.Windows.Forms.Form

 

일단, 해당 모듈 CommonTest.dll에서는 FileWrapperClass 라는 Class 제공하지 않는 것으로 보인다. Name FileWrapperClassEx 있는 것으로 봐서는 뭔가 version 문제로 보인다. 확실하게 하기 위해서는 !SOS/SaveModule <address> <filepath>하여 Dump load되어 있는 CommonTest.dll Drop하는 것이 좋을 하다. 그리고, ildasm.exe 통해 해당 모듈의 metadata Check하여 로드되어 있는 CommonTest.dll FileWrapperClass Type으로 가지고 있는 Check하는 것이 좋을 하다.

by 강세윤 | 2009/09/22 13:44 | Windows debugging | 트랙백 | 덧글(0)
트랙백 주소 : http://byung.egloos.com/tb/5120404
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글

< 이전페이지 다음페이지 >