Home All Groups Group Topic Archive Search About

Need help with .NET Reflection

Author
19 Nov 2007 12:03 PM
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

Author
22 Nov 2007 12:15 PM
Alexander Vasilevsky
Please try use
public static Assembly LoadFrom (
    string assemblyFile,
    Evidence securityEvidence
)
http://www.alvas.net  - Audio tools for C# and VB.Net developers


Show quote
"Sanat" <sanat.tiw***@gmail.com> ???????/???????? ? ???????? ?????????:
news:bd5945ad-ce68-4358-b3b7-17c1fd1ce883@b40g2000prf.googlegroups.com...
>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
Author
28 Nov 2007 11:09 AM
Sanat
Show quote
On 22 Nov, 17:15, "Alexander Vasilevsky" <al***@alvas.net> wrote:
> Please try use
> public static Assembly LoadFrom (
>         string assemblyFile,
>         Evidence securityEvidence
> )http://www.alvas.net - Audio tools for C# and VB.Netdevelopers
>
> "Sanat" <sanat.tiw***@gmail.com> ???????/???????? ? ???????? ?????????:news:bd5945ad-ce68-4358-b3b7-17c1fd1ce***@b40g2000prf.googlegroups.com...
>
>
>
> >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.

AddThis Social Bookmark Button