Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 200867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:08:57+00:00 2026-05-11T17:08:57+00:00

I’m intrigued by this answer from another SO thread, and I was hoping someone

  • 0

I’m intrigued by this answer from another SO thread, and I was hoping someone can help me shine some light on the concept.

Say I have a primary AppDomain and a bunch of child AppDomains, that are created and initialized by the primary AppDomain. In pseudo code:

Primary AppDomain:

class Parent
{
    public void InitChildren(IList<ChildInfo> children)
    {
        foreach (var childInfo in children)
        {
            var ad = CreateNewChildAppDomain();
            var child = (Child)ad.CreateInstanceAndUnwrap(typeof(Child));
            child.Init(this);
        }
    }

    public void Register(BasePoco info)
    {
        // Do something with info.
    }
}

Child AppDomain:

class Child : MarshalByRefObject
{
    public void Init(Parent parent)
    {
        parent.Register(new Container<MyInfo>(new MyInfo()));
    }
}

class MyInfo : BasePoco // <- not a MarshalByRefObject!
{
    public MyInfo() { ... }
}

During Init(), a child AppDomain instantiates a POCO object, which is non-marshalable by definition. Let’s also assume we cannot modify it in that regard.

The linked answer suggests that wrapping it in a Container<T> (which itself is marshalable) should allow it to be passed back to primary AppDomain. I understand this because it’s the proxy to Container<MyInfo> instance that really gets passed across.

What I don’t understand is how the primary AppDomain can possibly access the POCO instance in the container through the proxy of the container. I see the overloaded implicit cast operator in Container<T> and I understand it returns the contained POCO instance. But that instance isn’t being proxied itself – it’s still in the child AppDomain! So, shouldn’t this break?

What’s really going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:08:57+00:00Added an answer on May 11, 2026 at 5:08 pm

    As soon as the container returns the instance living in the other AppDomain (whether this happens via Value property or implicit conversion operator), the object will be marshalled. If it is a MarshalByRefObject, a new proxy will be generated so you can access it. Otherwise, the object will be copied (marshalled by value, serialized) into the current application domain.

    The only thing that the Container class shown in that question can help with is if you want to keep a proxy to another object which should not be marshalled. But in this case, you must not access the Value property or use the implicit conversion operator from the AppDomain where the proxy lives, because this would cause the object in the container to be marshaled. Still, you could use the container as argument into a method on an object living in the same AppDomain as the Container object, therefore basically allowing you to keep a reference to a non-marshallable object (not serializable and not MarshalByRef, or of a type in an assembly which cannot be loaded to the AppDomain with the proxy etc.) and to pass it around like a “handle”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Test::Unit uses at_exit for this, which runs code immediately before… May 12, 2026 at 1:00 am
  • Editorial Team
    Editorial Team added an answer Define a conversion operator: class SomeClass { public: operator std::string… May 12, 2026 at 1:00 am
  • Editorial Team
    Editorial Team added an answer I don't have exact numbers on the efficiency of the… May 12, 2026 at 1:00 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.