Need help with .NET Reflection

  • Thread starter Thread starter Sanat
  • Start date Start date
S

Sanat

I was working with loading .Net Assemblies through reflection to get
the list of all the classes along with their Methods and Properties
from any given module.
I am using native .Net method Assembly.LoadFrom(assemblyPathName) to
open msvcm80.dll (Managed VC runtime library file) and I am getting an
exception thrown that states A dynamic link library (DLL)
initialization routine failed. (Exception from HRESULT: 0x8007045A)

Here is the detailed exception information:
-----------------------------------------
Error : 10/31/2007 2:49:24 PM : FileReaderFactory.ExecuteReader(D:\Test
\File\msvcm80.dll)
Error Message : A dynamic link library (DLL) initialization routine
failed. (Exception from HRESULT: 0x8007045A)
System.IO.FileLoadException: A dynamic link library (DLL)
initialization routine failed. (Exception from HRESULT: 0x8007045A)
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark,
Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile,
Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm
hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at
MS.BGIT.Policheck.BL.ObjectRead.DotNetAssemblyReader.WriteDataInXML()
in D:\VSTFProjects\Policheck\Development\MS.BGIT.Policheck
\MS.BGIT.Policheck.BL.ObjectRead\FileReader
\DotNetAssemblyReader.cs:line 116
at
MS.BGIT.Policheck.BL.ObjectRead.DotNetAssemblyReader..ctor(String
absoluteFilePath, String workingDir) in D:\VSTFProjects\Policheck
\Development\MS.BGIT.Policheck\MS.BGIT.Policheck.BL.ObjectRead
\FileReader\DotNetAssemblyReader.cs:line 29
at
MS.BGIT.Policheck.BL.ObjectRead.FileReaderFactory.ExecuteReader(String
absoluteFilePath, String workingDirectory, Boolean isSrcComment,
FileReaderStatus& fileReaderStatus) in D:\VSTFProjects\Policheck
\Development\MS.BGIT.Policheck\MS.BGIT.Policheck.BL.ObjectRead
\FileReader\FileReaderFactory.cs:line 268
------------------------------------------------------------

Can anybody tell how can we load msvcm80.dll file to extract its class
and method information using .NET reflection.

Thanks!
Sanat Tiwari
 
Please try use
public static Assembly LoadFrom (
string assemblyFile,
Evidence securityEvidence
)
http://www.alvas.net - Audio tools for C# and VB.Net developers


Sanat said:
I was working with loading .Net Assemblies through reflection to get
the list of all the classes along with their Methods and Properties
from any given module.
I am using native .Net method Assembly.LoadFrom(assemblyPathName) to
open msvcm80.dll (Managed VC runtime library file) and I am getting an
exception thrown that states A dynamic link library (DLL)
initialization routine failed. (Exception from HRESULT: 0x8007045A)

Here is the detailed exception information:
-----------------------------------------
Error : 10/31/2007 2:49:24 PM : FileReaderFactory.ExecuteReader(D:\Test
\File\msvcm80.dll)
Error Message : A dynamic link library (DLL) initialization routine
failed. (Exception from HRESULT: 0x8007045A)
System.IO.FileLoadException: A dynamic link library (DLL)
initialization routine failed. (Exception from HRESULT: 0x8007045A)
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark,
Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile,
Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm
hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at
MS.BGIT.Policheck.BL.ObjectRead.DotNetAssemblyReader.WriteDataInXML()
in D:\VSTFProjects\Policheck\Development\MS.BGIT.Policheck
\MS.BGIT.Policheck.BL.ObjectRead\FileReader
\DotNetAssemblyReader.cs:line 116
at
MS.BGIT.Policheck.BL.ObjectRead.DotNetAssemblyReader..ctor(String
absoluteFilePath, String workingDir) in D:\VSTFProjects\Policheck
\Development\MS.BGIT.Policheck\MS.BGIT.Policheck.BL.ObjectRead
\FileReader\DotNetAssemblyReader.cs:line 29
at
MS.BGIT.Policheck.BL.ObjectRead.FileReaderFactory.ExecuteReader(String
absoluteFilePath, String workingDirectory, Boolean isSrcComment,
FileReaderStatus& fileReaderStatus) in D:\VSTFProjects\Policheck
\Development\MS.BGIT.Policheck\MS.BGIT.Policheck.BL.ObjectRead
\FileReader\FileReaderFactory.cs:line 268
------------------------------------------------------------

Can anybody tell how can we load msvcm80.dll file to extract its class
and method information using .NET reflection.

Thanks!
Sanat Tiwari
 
Please try use
public static Assembly LoadFrom (
string assemblyFile,
Evidence securityEvidence
)http://www.alvas.net - Audio tools for C# and VB.Netdevelopers

"Sanat" <[email protected]> ???????/???????? ? ???????? ?????????:

I was working with loading .NetAssemblies throughreflectionto get
the list of all the classes along with their Methods and Properties
from any given module.
I am using native .Netmethod Assembly.LoadFrom(assemblyPathName) to
open msvcm80.dll (Managed VC runtime library file) and I am getting an
exception thrown that states A dynamic link library (DLL)
initialization routine failed. (Exception from HRESULT: 0x8007045A)
Here is the detailed exception information:
-----------------------------------------
Error : 10/31/2007 2:49:24 PM : FileReaderFactory.ExecuteReader(D:\Test
\File\msvcm80.dll)
Error Message : A dynamic link library (DLL) initialization routine
failed. (Exception from HRESULT: 0x8007045A)
System.IO.FileLoadException: A dynamic link library (DLL)
initialization routine failed. (Exception from HRESULT: 0x8007045A)
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark,
Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile,
Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm
hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at
MS.BGIT.Policheck.BL.ObjectRead.DotNetAssemblyReader.WriteDataInXML()
in D:\VSTFProjects\Policheck\Development\MS.BGIT.Policheck
\MS.BGIT.Policheck.BL.ObjectRead\FileReader
\DotNetAssemblyReader.cs:line 116
at
MS.BGIT.Policheck.BL.ObjectRead.DotNetAssemblyReader..ctor(String
absoluteFilePath, String workingDir) in D:\VSTFProjects\Policheck
\Development\MS.BGIT.Policheck\MS.BGIT.Policheck.BL.ObjectRead
\FileReader\DotNetAssemblyReader.cs:line 29
at
MS.BGIT.Policheck.BL.ObjectRead.FileReaderFactory.ExecuteReader(String
absoluteFilePath, String workingDirectory, Boolean isSrcComment,
FileReaderStatus& fileReaderStatus) in D:\VSTFProjects\Policheck
\Development\MS.BGIT.Policheck\MS.BGIT.Policheck.BL.ObjectRead
\FileReader\FileReaderFactory.cs:line 268
------------------------------------------------------------
Can anybody tell how can we load msvcm80.dll file to extract its class
and method information using .NETreflection.
Thanks!
Sanat Tiwari- Hide quoted text -

- Show quoted text -

This too does not work. First thing is what type evidence we should
pass in it. I created an empty evidence object and passed it to
Assembly.LoadFrom() method but it still throws the Runtime Error!!
popup.
 
Back
Top