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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:44:54+00:00 2026-05-11T11:44:54+00:00

Let me give a scenario then see if anyone has a solution / work-around.

  • 0

Let me give a scenario then see if anyone has a solution / work-around.

I’ve got a library (DLL) that contains only classes. In another library, I’ve got interfaces that the classes in the first library implement. Clients will always reference only one version of the library containing the interfaces (always the latest one) – and only additions will be made to those interfaces (more interfaces / methods). Also, there will only be one version of that interfaces library – so that clients don’t need to update references (the interfaces library will be loaded through reflection – so the usual probing rules do not apply, we can only load what the client specifically asks for). The library implementing the interfaces will have multiple versions that different clients reference at the same time.

The problem occurs when a client assembly is referencing an old version of the implementation library. It creates an object from a class type in the implementation library – then passes it to another client assembly. That client assembly uses the latest (and only) version of the interfaces library and attempts to cast the object passed to it with the appropriate interface type. This cast fails with the exception ‘System.TypeLoadException: Method X in type Y from assembly Z does not have an implementation’. I expected this exception because in the new version of the interface (same version number – old library clobbered), method X is defined, but even though the old version of the object that is passed contains metadata that says it implements the corresponding interface, the mapping fails on the new interface method X because it doesn’t have any implementation in that class.

So, my question is this; Is there a way to have a client use that interface, but only cause an exception when a method that is not implemented on the referenced object is called (rather than the exception being generated when the referenced object is cast to the newer interface type)?

By the way – late binding isn’t an option because we want intellisense / compile time type checking … Also, I know how to do this with function pointers and wrapper classes – I was just hoping for a better solution that is more in tune with regular .NET types.

Thanks — Any help is greatly appreciated

  • 1 1 Answer
  • 2 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. 2026-05-11T11:44:54+00:00Added an answer on May 11, 2026 at 11:44 am

    You could use an abstract (MustInherit) Class instead of an Interface in the library containing the interfaces and set the methods and properties as Overridable. This way even if the methods just threw a not implemented exception there would always be an implementation for every method in the interface library. By making the methods Overridable rather than MustOverride should avoid the TypeLoadException.

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

Sidebar

Related Questions

Let me give you some background on my scenario. I got a multi language
I'm aware that there probably isn't a perfect solution to my question (this sounds
The title maybe a little vague, let me give you an example: if we
Let's have a library of objects Person , Cat , Dog , Pencil and
I've searched around the web to learn more about animating a character in Android
I like to give my variables, methods and objects descriptive names. Obviously not going
what I want to do is to give the user the ability to change
The following won't compile for me. I'm out of ideas... Any help? template<> inline
As of what I know about '&' operator, it returns the base address of
I'm looking to identify a best practice or often used design pattern for WCF

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.