HighTechTalks DotNet Forums  

How to get the Appdomain Object from AppDomain ID

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss How to get the Appdomain Object from AppDomain ID in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
John
 
Posts: n/a

Default How to get the Appdomain Object from AppDomain ID - 09-12-2006 , 02:48 PM






I have a AppDomain ID, how do I get the instance of the AppDomain
Object?
Please advice.
Thanks in advance.
John


Reply With Quote
  #2  
Old   
Jon Shemitz
 
Posts: n/a

Default Re: How to get the Appdomain Object from AppDomain ID - 09-12-2006 , 03:23 PM






John wrote:

Quote:
I have a AppDomain ID, how do I get the instance of the AppDomain
Object?
There might be a simpler way, but it looks to me like the only way to
do this is to enumerate the app domains in the process, checking their
id. There doesn't seem to be an unmanaged way to enumerate app domains
- see

<http://groups.google.com/group/microsoft.public.dotnet.framework.clr/browse_frm/thread/dba9c445ad8d5c3/9df14bf0af393c28?lnk=st&q=enumerate+appdomain+grou p%3Amicrosoft.public.dotnet.*&rnum=5#9df14bf0af393 c28>

for some code that uses the unmanaged, debug interface.

--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.


Reply With Quote
  #3  
Old   
John
 
Posts: n/a

Default Re: How to get the Appdomain Object from AppDomain ID - 09-12-2006 , 04:13 PM



Thx, but the EnumDomains only enumates the AppDomain in the current
process, how about the AppDomain in other processes?
Jon Shemitz wrote:
Quote:
John wrote:

I have a AppDomain ID, how do I get the instance of the AppDomain
Object?

There might be a simpler way, but it looks to me like the only way to
do this is to enumerate the app domains in the process, checking their
id. There doesn't seem to be an unmanaged way to enumerate app domains
- see

http://groups.google.com/group/micro...4bf0af393 c28

for some code that uses the unmanaged, debug interface.

--

.NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.


Reply With Quote
  #4  
Old   
Nicholas Paldino [.NET/C# MVP]
 
Posts: n/a

Default Re: How to get the Appdomain Object from AppDomain ID - 09-12-2006 , 11:51 PM



I doubt that this is exposed in a readily available way.

What is it that you are trying to do?


--
- Nicholas Paldino [.NET/C# MVP]
- mvp (AT) spam (DOT) guard.caspershouse.com

"John" <johnxhc (AT) yahoo (DOT) com> wrote

Quote:
Thx, but the EnumDomains only enumates the AppDomain in the current
process, how about the AppDomain in other processes?
Jon Shemitz wrote:
John wrote:

I have a AppDomain ID, how do I get the instance of the AppDomain
Object?

There might be a simpler way, but it looks to me like the only way to
do this is to enumerate the app domains in the process, checking their
id. There doesn't seem to be an unmanaged way to enumerate app domains
- see

http://groups.google.com/group/micro...4bf0af393 c28

for some code that uses the unmanaged, debug interface.

--

.NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.




Reply With Quote
  #5  
Old   
John
 
Posts: n/a

Default Re: How to get the Appdomain Object from AppDomain ID - 09-13-2006 , 11:22 AM



Basically, I want to use it as COM Global Interface Table, one app
Appdomain running in one process, setup some object it wants to expose
using Appdomain.SetData, another app in another process can use
IcorPublish to enumerate all the appDomain in the system and find out
the particular domain it is interesting. Get the AppDomainID, from the
AppDomainID, get the AppDomain Object, using AppDomain.GetData get the
Object, casting the Object to an interface pointer and use it.
Of course I know that I could achieve the same thing with .NET
Remoting, but it seem to me that if I could somehow get the AppDomain
Object from the AppDomainID, it will be much simpler than using
Remoting.
John
Nicholas Paldino [.NET/C# MVP] wrote:
Quote:
I doubt that this is exposed in a readily available way.

What is it that you are trying to do?


--
- Nicholas Paldino [.NET/C# MVP]
- mvp (AT) spam (DOT) guard.caspershouse.com

"John" <johnxhc (AT) yahoo (DOT) com> wrote in message
news:1158092028.572376.62600 (AT) d34g2000cwd (DOT) googlegroups.com...
Thx, but the EnumDomains only enumates the AppDomain in the current
process, how about the AppDomain in other processes?
Jon Shemitz wrote:
John wrote:

I have a AppDomain ID, how do I get the instance of the AppDomain
Object?

There might be a simpler way, but it looks to me like the only way to
do this is to enumerate the app domains in the process, checking their
id. There doesn't seem to be an unmanaged way to enumerate app domains
- see

http://groups.google.com/group/micro...4bf0af393 c28

for some code that uses the unmanaged, debug interface.

--

.NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.



Reply With Quote
  #6  
Old   
Ben Voigt
 
Posts: n/a

Default Re: How to get the Appdomain Object from AppDomain ID - 09-13-2006 , 12:11 PM




"John" <johnxhc (AT) yahoo (DOT) com> wrote

Quote:
Basically, I want to use it as COM Global Interface Table, one app
Appdomain running in one process, setup some object it wants to expose
using Appdomain.SetData, another app in another process can use
IcorPublish to enumerate all the appDomain in the system and find out
the particular domain it is interesting. Get the AppDomainID, from the
AppDomainID, get the AppDomain Object, using AppDomain.GetData get the
Object, casting the Object to an interface pointer and use it.
Of course I know that I could achieve the same thing with .NET
Remoting, but it seem to me that if I could somehow get the AppDomain
Object from the AppDomainID, it will be much simpler than using
Remoting.
You cannot directly use objects in another application, you need a proxy.
The COM Running Object Table creates a proxy when you lookup an object.

Quote:
John
Nicholas Paldino [.NET/C# MVP] wrote:
I doubt that this is exposed in a readily available way.

What is it that you are trying to do?


--
- Nicholas Paldino [.NET/C# MVP]
- mvp (AT) spam (DOT) guard.caspershouse.com

"John" <johnxhc (AT) yahoo (DOT) com> wrote in message
news:1158092028.572376.62600 (AT) d34g2000cwd (DOT) googlegroups.com...
Thx, but the EnumDomains only enumates the AppDomain in the current
process, how about the AppDomain in other processes?
Jon Shemitz wrote:
John wrote:

I have a AppDomain ID, how do I get the instance of the AppDomain
Object?

There might be a simpler way, but it looks to me like the only way to
do this is to enumerate the app domains in the process, checking their
id. There doesn't seem to be an unmanaged way to enumerate app domains
- see

http://groups.google.com/group/micro...4bf0af393 c28

for some code that uses the unmanaged, debug interface.

--

.NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.





Reply With Quote
  #7  
Old   
Jon Shemitz
 
Posts: n/a

Default Re: How to get the Appdomain Object from AppDomain ID - 09-13-2006 , 01:25 PM



John wrote:

Quote:
Basically, I want to use it as COM Global Interface Table, one app
Appdomain running in one process, setup some object it wants to expose
using Appdomain.SetData, another app in another process can use
IcorPublish to enumerate all the appDomain in the system and find out
the particular domain it is interesting. Get the AppDomainID, from the
AppDomainID, get the AppDomain Object, using AppDomain.GetData get the
Object, casting the Object to an interface pointer and use it.
Of course I know that I could achieve the same thing with .NET
Remoting, but it seem to me that if I could somehow get the AppDomain
Object from the AppDomainID, it will be much simpler than using
Remoting.
It doesn't sound simpler! Remoting is very easy to use at a Hello
World level, and that is perfectly adequate for many applications. It
also supports additional complexity (lease management, channel sinks,
&c) for the apps that need it. It's documented and supported; there
are users out there who've probably solved any problem you'll run
into.

Seems a lot simpler than building your own infrastructure and
increasing your reliance on (ugh!) COM.

--

..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.


Reply With Quote
  #8  
Old   
Ben Voigt
 
Posts: n/a

Default Re: How to get the Appdomain Object from AppDomain ID - 09-13-2006 , 01:35 PM




"Jon Shemitz" <jon (AT) midnightbeach (DOT) com> wrote

Quote:
John wrote:

Basically, I want to use it as COM Global Interface Table, one app
Appdomain running in one process, setup some object it wants to expose
using Appdomain.SetData, another app in another process can use
IcorPublish to enumerate all the appDomain in the system and find out
the particular domain it is interesting. Get the AppDomainID, from the
AppDomainID, get the AppDomain Object, using AppDomain.GetData get the
Object, casting the Object to an interface pointer and use it.
Of course I know that I could achieve the same thing with .NET
Remoting, but it seem to me that if I could somehow get the AppDomain
Object from the AppDomainID, it will be much simpler than using
Remoting.

It doesn't sound simpler! Remoting is very easy to use at a Hello
World level, and that is perfectly adequate for many applications. It
also supports additional complexity (lease management, channel sinks,
&c) for the apps that need it. It's documented and supported; there
are users out there who've probably solved any problem you'll run
into.
If you don't want to use Remoting, then try Web Services (WSDL) for which
..NET also has good support.

Quote:
Seems a lot simpler than building your own infrastructure and
increasing your reliance on (ugh!) COM.

--

.NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.



Reply With Quote
  #9  
Old   
John
 
Posts: n/a

Default Re: How to get the Appdomain Object from AppDomain ID - 09-13-2006 , 03:29 PM



no, not , I am not using COM, when I talk about COM GIT, I am talking
about I want to using the feature similiar to COM GIT, what I want to
do has nothing to do with COM.
I still beleive that if somehow I could get the AppDomain Object from
an AppDomain ID, it will be much easier than the remoting, because all
I need to do is the following

1) AppDomain app=GetAppDomainFromAppDomainID();
2) IMyInterface imf =(IMyInterface )app.GetData();
3) imf.method1();

Jon Shemitz wrote:
Quote:
John wrote:

Basically, I want to use it as COM Global Interface Table, one app
Appdomain running in one process, setup some object it wants to expose
using Appdomain.SetData, another app in another process can use
IcorPublish to enumerate all the appDomain in the system and find out
the particular domain it is interesting. Get the AppDomainID, from the
AppDomainID, get the AppDomain Object, using AppDomain.GetData get the
Object, casting the Object to an interface pointer and use it.
Of course I know that I could achieve the same thing with .NET
Remoting, but it seem to me that if I could somehow get the AppDomain
Object from the AppDomainID, it will be much simpler than using
Remoting.

It doesn't sound simpler! Remoting is very easy to use at a Hello
World level, and that is perfectly adequate for many applications. It
also supports additional complexity (lease management, channel sinks,
&c) for the apps that need it. It's documented and supported; there
are users out there who've probably solved any problem you'll run
into.

Seems a lot simpler than building your own infrastructure and
increasing your reliance on (ugh!) COM.

--

.NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.


Reply With Quote
  #10  
Old   
John
 
Posts: n/a

Default Re: How to get the Appdomain Object from AppDomain ID - 09-13-2006 , 03:32 PM



I believe if you are calling the object from another appdomain, the
proxy is automatically created for you.
Ben Voigt wrote:
Quote:
"John" <johnxhc (AT) yahoo (DOT) com> wrote in message
news:1158160939.979310.289370 (AT) e63g2000cwd (DOT) googlegroups.com...
Basically, I want to use it as COM Global Interface Table, one app
Appdomain running in one process, setup some object it wants to expose
using Appdomain.SetData, another app in another process can use
IcorPublish to enumerate all the appDomain in the system and find out
the particular domain it is interesting. Get the AppDomainID, from the
AppDomainID, get the AppDomain Object, using AppDomain.GetData get the
Object, casting the Object to an interface pointer and use it.
Of course I know that I could achieve the same thing with .NET
Remoting, but it seem to me that if I could somehow get the AppDomain
Object from the AppDomainID, it will be much simpler than using
Remoting.

You cannot directly use objects in another application, you need a proxy.
The COM Running Object Table creates a proxy when you lookup an object.

John
Nicholas Paldino [.NET/C# MVP] wrote:
I doubt that this is exposed in a readily available way.

What is it that you are trying to do?


--
- Nicholas Paldino [.NET/C# MVP]
- mvp (AT) spam (DOT) guard.caspershouse.com

"John" <johnxhc (AT) yahoo (DOT) com> wrote in message
news:1158092028.572376.62600 (AT) d34g2000cwd (DOT) googlegroups.com...
Thx, but the EnumDomains only enumates the AppDomain in the current
process, how about the AppDomain in other processes?
Jon Shemitz wrote:
John wrote:

I have a AppDomain ID, how do I get the instance of the AppDomain
Object?

There might be a simpler way, but it looks to me like the only way to
do this is to enumerate the app domains in the process, checking their
id. There doesn't seem to be an unmanaged way to enumerate app domains
- see

http://groups.google.com/group/micro...4bf0af393 c28

for some code that uses the unmanaged, debug interface.

--

.NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn Great reviews & good sales.




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.