473,698 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Appdomain cannot load assembly... why?

Hi, (My code is at the end of this post)

I have an AppDomain that must load a simple assembly that has only one class
with one method and it does not work... I receive this exception : "Could
not load file or assembly 'ModuleLoader.d ll' or one of its dependencies. The
system cannot find the file specified."

Does anyone have an idea of something I'm missing?

Thanks

ThunderMusic

Expand|Select|Wrap|Line Numbers
  1.  
  2. *** Main App (calling method) ***
  3. AppDomainSetup ads = new AppDomainSetup();
  4. ads.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
  5. ads.PrivateBinPath = AppDomain.CurrentDomain.BaseDirectory;
  6. ads.DisallowBindingRedirects = false;
  7. ads.DisallowCodeDownload = true;
  8. m_CurrentMonitorAppDomain = AppDomain.CreateDomain("MonitorLoader", null,
  9. ads);
  10. // The following call fails
  11. MonitoringModuleLoader mml =
  12. (MonitoringModuleLoader)m_CurrentMonitorAppDomain.CreateInstanceAndUnwrap("ModuleLoader.dll",
  13. "ModuleLoader.MonitoringModuleLoader");
  14.  
  15. *** The "ModuleLoader" library ***
  16. namespace ModuleLoader
  17. {
  18. public class MonitoringModuleLoader : MarshalByRefObject
  19. {
  20. public MonitoringModuleLoader()
  21. {
  22. }
  23. public MonitorBase Load(byte[] LibBytes, string ModuleName)
  24. {
  25. return null;
  26. }
  27. }
  28. }
  29.  
  30.  

Jan 14 '08 #1
1 3625
finally, I found the problem... I was using 'CreateInstance AndUnwrap' and
should have used 'CreateInstance FromAndUnwrap'

Thanks
"ThunderMus ic" <No************ *************@N oSpAm.comwrote in message
news:eq******** ******@TK2MSFTN GP05.phx.gbl...
Hi, (My code is at the end of this post)

I have an AppDomain that must load a simple assembly that has only one
class with one method and it does not work... I receive this exception :
"Could not load file or assembly 'ModuleLoader.d ll' or one of its
dependencies. The system cannot find the file specified."

Does anyone have an idea of something I'm missing?

Thanks

ThunderMusic

Expand|Select|Wrap|Line Numbers
  1. *** Main App (calling method) ***
  2. AppDomainSetup ads = new AppDomainSetup();
  3. ads.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
  4. ads.PrivateBinPath = AppDomain.CurrentDomain.BaseDirectory;
  5. ads.DisallowBindingRedirects = false;
  6. ads.DisallowCodeDownload = true;
  7. m_CurrentMonitorAppDomain = AppDomain.CreateDomain("MonitorLoader", null,
  8. ads);
  9. // The following call fails
  10. MonitoringModuleLoader mml =
  11. (MonitoringModuleLoader)m_CurrentMonitorAppDomain.CreateInstanceAndUnwrap("ModuleLoader.dll",
  12. "ModuleLoader.MonitoringModuleLoader");
  13. *** The "ModuleLoader" library ***
  14. namespace ModuleLoader
  15. {
  16.    public class MonitoringModuleLoader : MarshalByRefObject
  17.    {
  18.        public MonitoringModuleLoader()
  19.        {
  20.        }
  21.        public MonitorBase Load(byte[] LibBytes, string ModuleName)
  22.        {
  23.            return null;
  24.        }
  25.    }
  26. }
  27.  

Jan 14 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
380
by: Satinderpal Singh | last post by:
Hi All, I have an EXE, I load the DLL from that exe in a seperate AppDomain. (I have not given reference to that DLL from the EXE). Now, i call some commands of that dll from the EXE, and in the background i try to delete the DLL, it does not allows (fair enough). Now, I unload that AppDomain using AppDomain.Unload method. Now, I try to delete that DLL from the background it still does not allows, I thought the
4
4200
by: stu_pb | last post by:
I am designing a plugin system for a window application using .NET(C# specifically). One of the requirements of the plugin system is to be able to dynamically load/unload plugins. My initial thought was to use System.Reflection.Assembly.Load to load the plugins dynamically. This worked great, but I was left with no way to dynamically unload the plugin. So now I come to creating a new AppDomain for the plugins to reside in, since the...
4
6103
by: Mirano | last post by:
Hi everybody. I load an assembly into another AppDomain, not a default one. As there is no way to unload the assembly, I need to unload the domain. This is where the app hangs. The problem is this assembly has references to one dll, currently not performing any work. I tried this: 1. Setting the assembly to null, 2. Implementing a ClassFactory and returning an interface of the object,
8
5086
by: A. Elamiri | last post by:
Hello, I created a small app which acts as a services manager. I basically drop a DLL in a Services folder and set the frequency through the application for how often do I want the code in the assembly to run (scheduler). I created a seperate AppDomain here is the code: .... AppDomainSetup ads = new AppDomainSetup(); string path =
6
8194
by: Wal Turner | last post by:
Hi there. There are various snippets on forums regarding issues with AppDomain.Unload and how it just doesnt work. Fortunately, I got it working with the base case, after much fiddling. Consider this 5 line program: AppDomain domain = AppDomain.CreateDomain("MyDomain"); domain.CreateInstance("TempDLL", "TempDLL.Class1"); MessageBox.Show("try deleting file now"); //cant delete file AppDomain.Unload(domain);
1
2427
by: John | last post by:
Hi, I tried to load a mixedmode dll (MC++) with AppDomain.Load(Byte ) in a C# Client. During the Load Process I got the following Exception: System.IO.FileLoadException: Ausnahme von HRESULT: 0x80131019. at System.Reflection.Assembly.nLoadImage(Byte rawAssembly, Byte rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark) at System.AppDomain.Load(Byte rawAssembly) ...
4
4470
by: =?Utf-8?B?SmFu?= | last post by:
I have a .NET 2.0 application divided in two assemblies; the exe and a dll. The application generates a plugin-dll which is then loaded in a separate AppDomain (along with a second instance of my application dll). It's been working for months and now the it's not working from my application exe anymore but still working from NUnit when testing the dll. What could have changed in my exe? Some configuration thing in my VS2005 project?
0
1400
by: =?Utf-8?B?VmFubmk=?= | last post by:
Hello, I am trying to load up an Assembly in a newly created AppDomain: m_TempAppDomain = AppDomain.CreateDomain("Temporary", null, AppDomain.CurrentDomain.SetupInformation); byte AssemblyBytes = GetAssemblyBytes(assemblyPath); m_TempAppDomain.Load(AssemblyBytes);
1
2099
by: ThunderMusic | last post by:
Hi, (My code is at the end of this post) I have an AppDomain that must load a simple assembly that has only one class with one method and it does not work... I receive this exception : "Could not load file or assembly 'ModuleLoader.dll' or one of its dependencies. The system cannot find the file specified." Does anyone have an idea of something I'm missing? Thanks
4
5337
by: illegal.prime | last post by:
Hi all, I'm getting unexpected results when trying to preload assemblies into an AppDomain I'm creating. Upon creation of the AppDomain - I attach an AssemblyResolve to both my current AppDomain and the new AppDomain I create. I copy all the assemblies/dlls into a new directory and then try loading them all into the new AppDomain using the following: private void LoadAssembliesFromDirectory(AppDomain appDomain, string directory)
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9027
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7725
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.