Visual Studio 2005, .NET FrameWork 2.0, C#, WinForms Application
Hi,
I've read the recent posts by and to 'Thunderbird' (and learned a lot,
thanks, from the usual masters Skeet and Paladino, and others) which involve
AppDomains in a remoting scenario, but I think the issue I am working with
.... while related ... is sufficiently different to warrant a new thread.
I'm also working on a plug-in architecture it's for a WinForms based
project.
At run-time I "discover" and load all the Plug-Ins that match a MainApp
Interface with no problem.
I find I can pass complex objects (like the TreeNode of a TreeView) to the
plug-ins' AppDomain, and modify certain properties and have the result show
up in the Main App's UI, no problem.
What I find I can't do ... I assume because WinForm objects like a TreeView
and the Nodes collection object of a TreeView are passed as proxies ... is
create new Nodes in the plug-in app domain and then pass them back to the
Main app and put them in the TreeView in the UI there.
Error trying to create a new TreeView Node in the Plug-In appDomain (yes,
Plug-Ins do contain references for WinForms) :
"SerializationE xception Crossed an AppDomain Boundary"
Type 'System.Windows .Forms.Control+ ControlCollecti on' in assembly
'System.Windows .Forms, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9' is not marked as serializable.
"Ideally" I'd like to pass the Plug-In a bounding rectangle definition, have
it create a collection of controls, and get those controls back to the Main
AppDomain and plug them into a Panel and then have the Plug-In, based on the
state of its controls, do the "right thing" to conjure up whatever objects
it wants to create and get those objects back to the Main App for
display/use in the main UI.
At this point I believe that is simply not possible ... although Jon Skeet's
comments in his reply to Thunderbird are still inviting me to reconsider and
re-think.
What I do believe is most probable is that there is an optimum architecture
for a situation where :
1. you want to load plug-ins in a separate appDomain (in T'Bird's case one
appDomain per plug-in). so you can unload at will.
2. you want the plug-in to specify its run-time user interface to the Main
appDomain in some terse, easily parsable form.
3. you want the Main appDomain to present the Plug-In's controls/widgets in
the main UI, let the user alter their state at run-time.
4. you want the Plug-In (through direct action at run-time) to trigger some
process that results in modification of complex objects, or creation of new
ones in the Main appDomain.
Appreciate any feedback. I have examined the various add-in/plug-in projects
of CodeProject, the usual books (Petzold, Sells, Liberty, Gunnerson).
It would help me greatly if I had a better sense of exactly what a "proxy"
is, and I appreciate any referrals to learning materials in that area.
thanks !
Bill Woodruff
dotScience
Chiang Mai, Thailand 1 4288
Bill Woodruff <ms*********@do tscience.comwro te:
<snip>
At this point I believe that is simply not possible ... although Jon Skeet's
comments in his reply to Thunderbird are still inviting me to reconsider and
re-think.
Well, it sounds like we're doing significantly different things. In my
case I was able to have a whole area of the main UI which the plugin
"owned", running that UI in a different thread.
What I do believe is most probable is that there is an optimum architecture
for a situation where :
1. you want to load plug-ins in a separate appDomain (in T'Bird's case one
appDomain per plug-in). so you can unload at will.
2. you want the plug-in to specify its run-time user interface to the Main
appDomain in some terse, easily parsable form.
3. you want the Main appDomain to present the Plug-In's controls/widgets in
the main UI, let the user alter their state at run-time.
4. you want the Plug-In (through direct action at run-time) to trigger some
process that results in modification of complex objects, or creation of new
ones in the Main appDomain.
Right, that sounds like a reasonable architecture, yes. Easier with WPF
of course, because of the business of specifying the user interface is
easy :)
It would help me greatly if I had a better sense of exactly what a "proxy"
is, and I appreciate any referrals to learning materials in that area.
Yes - AppDomains and marshalling is a fairly difficult topic to find
information about. Basically anything which derives from
MarshalByRefObj ect can be marshalled across an AppDomain boundary by
(automatically) creating a proxy which has a reference to the original
object. However, there are limitations as to what you can do, and I'm
afraid I'm far from an expert on that side of things :(
I basically try to do as little as possible across the app domain
boundary.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Daylor |
last post by:
in win32 process , when u create new process,u have new main thread.
i know,appDomain r logical procces,that exists in 1 win32 process.
the q:
is there way to create second appDomain (the first 1 is the defualt
appDomain) with his new ("main") thread ?
if not ,what is the easy and clear way to create new thread on the new
appDomain ?
|
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...
|
by: Altramagnus |
last post by:
I have 30 - 40 type of different window.
For each type I need about 20 instances of the window.
When I try to create them, I get "Error creating window handle"
My guess is there is a maximum number of window handle, because if I reduce
to about 2 instances of each window,
it can run. But not 20 instances of each window.
Does anyone know what the problem is? is it really because it exceeds the
maximum number of window handle?
|
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 unload the plugin.
So now I come to creating a new AppDomain for the plugins to reside in,
since the...
|
by: David Li |
last post by:
I am having a lot of problem with following code. To start with
I have a working sets of code and the top level SystemC code looks
like this:
----------working main.cpp start here -------------------
#include "C:\SystemC\systemc-2.0.1\src\systemc.h"
#include "stimulus.h"
#include "display.h"
#include "fir.h"
| |
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 ClassFactory and returning an interface of the object,
|
by: kozen |
last post by:
I want to pass a WinForm control from main appDomain A to another appDomain
B.
In appDomain B, i will create some WinForm controls and add them to the
control's child controls list of main appDomain A .
But i failed, please tell me why. thanks!
code sample:
// BOView will be created in appDomain B.
// BOView receive aParCtrl from main appDomain A, then add some controls to
|
by: Rain |
last post by:
How do we know if the appDomain.unload is working? i've tried deleting the
dll inside a program right after unloading the appdomain but there was a
exception.. SystemUnauthorizedAccess. Thanks!
|
by: mickeymicks |
last post by:
Hello all!
Im 'trying' to make a plugin-based application (system) - everything except
the main window are plugins (all other sub-windows, panels, etc).
Each plugin comes from dll's.. and each dll is loaded on a separate
AppDomain..
my question:
Does creating a new AppDomain, automatically start a new thread?
|
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...
|
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,...
| |
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |