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 6835783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:16:26+00:00 2026-05-26T23:16:26+00:00

In my situation there are three components: Consumer class, IExposedIface interface and Exposed class

  • 0

In my situation there are three components: Consumer class, IExposedIface interface and Exposed class implementing IExposedIface. Both Consumer and Exposed are linked statically with IExposedIface, but Consumer bears no compile-time reference to Exposed.

I am trying to come up with a scheme which would allow Consumer loading different versions of Exposed at runtime (depending on input data – let’s say each input document carries an information about which version of Exposed should be used to process it). To achieve this, I started studying AppDomains and now I have a basic version working.

So far it seems to me there are two options when it comes to providing IExposedIface assembly to Exposed assembly.

  1. Having IExposedIface.dll only in Consumer‘s bin directory and handling AppDomain.AssemblyResolve event for the AppDomain in which I am creating an instance of Exposed

  2. Having IExposedIface.dll both in Consumer‘s bin directory as well as aside each Exposed.dll.

Now consider that I build Exposed against this IExposedIface:

public interface IExposedIface
{
    string SaySomething();    
}

and I build Consumer against this IExposedIface:

public interface IExposedIface
{
    string SaySomething();
    string SaySomethingDifferent();
}

In the first case, the exception

Exception: Method ‘SaySomethingDifferent’ in type ‘Exposed.Exposed’ from
assembly ‘Exposed, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have an implementation.

is thrown in the moment I call appDomain.CreateInstanceAndUnwrap(...) to create an instance of Exposed in the freshly created AppDomain.

That looks reasonable to me.

But in the second case, appDomain.CreateInstanceAndUnwrap(...) goes through just fine and I can without problems call ‘SaySomething()’ method on the retrieved object. An exception

The method ‘SaySomethingDifferent’ was not found on the interface/type ‘IExposedIface.IExposedIface, IExposedIface, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null’.

is only thrown when I actually call SaySomethingDifferent() in Consumer.

I was quite surprised that in this second case CLR had let me go so far…Could someone explain why this is possible?

  • 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-26T23:16:27+00:00Added an answer on May 26, 2026 at 11:16 pm
    1. Case #1 means that Exposed.dll is binding against the wrong version of IExposedIface.dll – the metadata loader is able to detect this when loading the assemblies because it finds an unimplemented interface method.

    2. Case #2 (probably) means that you have the correct version of each IExposedIface.dll besides each Exposed.dll so each assembly can load within its own AppDomain. However AppDomain A has a different interface than AppDomain B which is only a problem when the call actually crosses the AppDomain border.

    I’d suggest not trying those binary compatibility games and rather do proper versioning (ie. create a new interface with the new methods, inheriting from the old interface, so the new version of IExposedIface.dll is really backwards compatible). Anything else is really hard to debug because you can accidently end up loading both versions of IExposedIface.dll if they are reachable for windows, and then you have two versions of a Type in the AppDomain causing no end of trouble 😉

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

Sidebar

Related Questions

I have 2 components (AWriter and BWriter) where both implement IWriter interface. And I
Situation: There are several entities in a simulated environment, which has an artificial notion
I have the following situation: There is a tool that gets an XSLT from
I have the following situation: There is one custom view inside of the first
I have this situation: There are a login page with a login form (form
Situation is like this: There are independent 5 services. Each service consists of a
is there any way how in this situation insert and update DB with single
Is there anything better than a Trie for this situation? Storing a list of
Is there a PostgreSQL HA solution that can handle a splitbrain situation gracefully. To
There is the situation - i made some math modelling app on C#(WPF), showing

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.