473,603 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AppDomain and delegate... How?????

I have created a new AppDomain from within my window Service.
I need to pass some delegates to an instance of a class loaded in the other
appDomain.

With the way I currently do it, the delegates get called. HOWEVER, in the
second appDomain and not
in my main AppDomain.
The class that contains the delegates is derived from MarshalByRefObj ect.

Heeeeeelp!
Thanks :-)


========Snippet of my code =============
// ...
AppDomain gAppDomain;
gAppDomain = AppDomain.Creat eDomain ("FileAcquistio nRamitAppDomain ", null,
setup);
Object o = gAppDomain.Crea teInstanceAndUn wrap(
Assembly.GetExe cutingAssembly( ).FullName,

typeof(RamitRec eiveWrapper).Fu llName);

// local object to access object located in other AppDomain
RamitWrapperApp Domain = (FileAcquisitio n.RamitReceiveW rapper)o;

//
// initialize callbacks for customized treatments /// <----- here I pass
my delegates
//
gcbProcImg = new RamitReceiveWra pper.FProcImg(F ileReceiver.Sto reImage);
gcbExitRamit = new RamitReceiveWra pper.FExitRamit (FileReceiver.E xitRamit);
RamitWrapperApp Domain.DefineRa mitDelegates(re f gcbProcImg, ref
gcbExitRamit);
//...
Nov 15 '05 #1
1 3189
Found it!

Method passed in delegate should not be declared static.

José
"José Joye" <jo*******@KILL THESPAMSbluewin .ch> wrote in message
news:u3******** ******@TK2MSFTN GP12.phx.gbl...
I have created a new AppDomain from within my window Service.
I need to pass some delegates to an instance of a class loaded in the other appDomain.

With the way I currently do it, the delegates get called. HOWEVER, in the
second appDomain and not
in my main AppDomain.
The class that contains the delegates is derived from MarshalByRefObj ect.

Heeeeeelp!
Thanks :-)


========Snippet of my code =============
// ...
AppDomain gAppDomain;
gAppDomain = AppDomain.Creat eDomain ("FileAcquistio nRamitAppDomain ", null,
setup);
Object o = gAppDomain.Crea teInstanceAndUn wrap(
Assembly.GetExe cutingAssembly( ).FullName,

typeof(RamitRec eiveWrapper).Fu llName);

// local object to access object located in other AppDomain
RamitWrapperApp Domain = (FileAcquisitio n.RamitReceiveW rapper)o;

//
// initialize callbacks for customized treatments /// <----- here I pass my delegates
//
gcbProcImg = new RamitReceiveWra pper.FProcImg(F ileReceiver.Sto reImage);
gcbExitRamit = new RamitReceiveWra pper.FExitRamit (FileReceiver.E xitRamit);
RamitWrapperApp Domain.DefineRa mitDelegates(re f gcbProcImg, ref
gcbExitRamit);
//...

Nov 15 '05 #2

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

Similar topics

1
1351
by: José Joye | last post by:
I have created a new AppDomain from within my window Service. I need to pass some delegates to an instance of a class loaded in the other appDomain. With the way I currently do it, the delegates get called. HOWEVER, in the second appDomain and not in my main AppDomain. The class that contains the delegates is derived from MarshalByRefObject. Heeeeeelp!
7
2371
by: José Joye | last post by:
I have a windows service where I create another appdomains. In the newly created AppDomain, I make use of a C library. If I issue an Abort(1) within this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How could I prevent my main AppDomain to stop when the other stopped?Thanks a lot,José
5
15356
by: Chris | last post by:
Hi I have a scenario where I've created another AppDomain to dynamically load a DLL(s) into. In this newly loaded DLL I want to call a static method on a class. The problem arise is that I have the same class/static method definition statictly linked to my EXE and when I call InvokeMember(...), even though I got the Type from the new AppDomain, it calls the static method that I am staticly linked to and not the static method in the dynamicly...
4
2345
by: Chris Lacey | last post by:
Hi, I'm currently writing a scheduling service which starts a number DotNet executables, each within a new AppDomain, every ten seconds. The guts of the code is as follows: // For each executable in the list of tasks for (int i = 0; i < this.processTasks.Length; i++) {
2
4816
by: Martin Lapierre | last post by:
How can I remove the default exception handler handler? When adding a custom handler, I can't get rid of the VS.NET unhandled exception dialog. Ex: AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler); MyHandler gets called AFTER the default VS.NET unhandled exception handler
8
5079
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 =
0
2087
by: JPSutor | last post by:
This method is asynchronous and therefore does not return any value. I realize that it executes the code in another application domain that is identified by the specified delegate passed into the method. The problem is that if the delegate method passed is of type CrossAppDomainDelegate and takes some time to perform it's tasks (WinFormsHelper.Cleanup), and our application is being shutdown prior to this being done. Consequently,the...
2
2654
by: csprakash | last post by:
Hi All, I want to run some user when an Application is started, or when a worker process is started. Application_Start, Init methods of HttpApplication in Global.asax.cs are of not use, as they are called only on the first call to an aspx page in the application. They are not called during the initialization of the worker process (or) Application Domain. Is this possible at all? I came accross a delegate "AppDomainInitializer", is this...
4
5333
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
7996
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7928
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8415
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
8273
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...
1
5878
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
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
3903
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1514
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1259
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.