473,480 Members | 2,230 Online
Bytes | Software Development & Data Engineering Community
Create 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 MarshalByRefObject.

Heeeeeelp!
Thanks :-)


========Snippet of my code =============
// ...
AppDomain gAppDomain;
gAppDomain = AppDomain.CreateDomain ("FileAcquistionRamitAppDomain", null,
setup);
Object o = gAppDomain.CreateInstanceAndUnwrap(
Assembly.GetExecutingAssembly().FullName,

typeof(RamitReceiveWrapper).FullName);

// local object to access object located in other AppDomain
RamitWrapperAppDomain = (FileAcquisition.RamitReceiveWrapper)o;

//
// initialize callbacks for customized treatments /// <----- here I pass
my delegates
//
gcbProcImg = new RamitReceiveWrapper.FProcImg(FileReceiver.StoreIma ge);
gcbExitRamit = new RamitReceiveWrapper.FExitRamit(FileReceiver.ExitRa mit);
RamitWrapperAppDomain.DefineRamitDelegates(ref gcbProcImg, ref
gcbExitRamit);
//...
Nov 15 '05 #1
1 3181
Found it!

Method passed in delegate should not be declared static.

José
"José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message
news:u3**************@TK2MSFTNGP12.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 MarshalByRefObject.

Heeeeeelp!
Thanks :-)


========Snippet of my code =============
// ...
AppDomain gAppDomain;
gAppDomain = AppDomain.CreateDomain ("FileAcquistionRamitAppDomain", null,
setup);
Object o = gAppDomain.CreateInstanceAndUnwrap(
Assembly.GetExecutingAssembly().FullName,

typeof(RamitReceiveWrapper).FullName);

// local object to access object located in other AppDomain
RamitWrapperAppDomain = (FileAcquisition.RamitReceiveWrapper)o;

//
// initialize callbacks for customized treatments /// <----- here I pass my delegates
//
gcbProcImg = new RamitReceiveWrapper.FProcImg(FileReceiver.StoreIma ge);
gcbExitRamit = new RamitReceiveWrapper.FExitRamit(FileReceiver.ExitRa mit);
RamitWrapperAppDomain.DefineRamitDelegates(ref 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
1338
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...
7
2353
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...
5
15331
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...
4
2330
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...
2
4806
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 =...
8
5069
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...
0
2072
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...
2
2648
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...
4
5324
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
6912
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...
0
7052
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,...
1
6744
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
6981
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
5348
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,...
1
4790
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...
0
3000
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...
0
2989
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
565
muto222
php
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.