473,388 Members | 1,177 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,388 software developers and data experts.

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);
//...
Jul 21 '05 #1
1 1335
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);
//...

Jul 21 '05 #2

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

Similar topics

7
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
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
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
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 =...
1
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...
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...
0
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
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
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...

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.