OutOfMemoryException in Assembly.LoadFile

I am very much embarrassed by this. Sometimes, when I call Reflection.Assembly.LoadFile("path to my dll"), he gives out OutOfMemoryException.

StackTrace only shows:

at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)

And no, InnerExceptionto check more detailed information about the exception.

However, only through COM seems.

Let me explain:

My application can be launched as a regular old exe or through Excel via the COM ( CreateObject("blahblahblah")) interface

After initializing one of my GUI classes, it will statically load all my engine DLL files (my application has a engine and a graphical interface)

A total of 6 DLL files with the engine - statically loaded assembler code is located in VB.NET and looks something like this:

Private Shared dllPath As String = System.IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly().Location) & System.IO.Path.DirectorySeparatorChar)
Private Shared ReadOnly engineDLL1 As Reflection.Assembly = Reflection.Assembly.LoadFile(dllPath + "engineDLL1_name.dll")
...
Private Shared ReadOnly engineDLL6 As Reflection.Assembly = Reflection.Assembly.LoadFile(dllPath + "engineDLL6_name.dll")

DLL , , - ( ++) - , .

, procexp, , , DLL . , COM ( Excel, CreateObject("ProgID of the class with the code above")), OutOfMemoryException engineDLL4.

- - , !

+4

All Articles