473,566 Members | 2,770 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 2091
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

4
4189
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...
4
6084
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...
8
5078
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
8184
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");...
1
2421
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...
4
4452
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...
0
1397
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
3607
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...
4
5332
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...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8108
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...
1
7644
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...
0
7951
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...
0
6260
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...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2083
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
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.