473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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.dll' 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 2076
finally, I found the problem... I was using 'CreateInstanceAndUnwrap' and
should have used 'CreateInstanceFromAndUnwrap'

Thanks
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:eq**************@TK2MSFTNGP05.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.dll' 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
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...
4
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...
8
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...
6
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...
1
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...
4
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...
0
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...
1
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.