Home All Groups Group Topic Archive Search About

dynamicly loaded assemblies and types

Author
9 Feb 2006 2:13 PM
DrBytes
Hey,.. I have a problem with dynamicly loaded assemblies, it can't resolve
the types.
In the main app i have a reference to a 'toolkit' dll containing IFunky and
class Funky : IFunky.
In a dynamicly loaded assembly I also have a reference to toolkit and
another class called TooFunky : Funky.

So in the main app I try to load this specialized class TooFunky as a type
of Funky (also tried IFunky) by calling upon an utility class's method in the
dynamicly loaded assembly and with the following signature like this:
public Funky GetFunky()
{
    return new TooFunky();
}

And then I get :
Type is not resolved for member 'MadeUpNamespace.TooFunky, TooFunky,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
System.Exception {System.Runtime.Serialization.SerializationException}

The idea is to load specialized classes into the main app that support
IFunk's interface.

Anybody that can help?
Thanks in advance!

Author
9 Feb 2006 6:16 PM
Jon Skeet [C# MVP]
DrBytes <DrBy***@discussions.microsoft.com> wrote:
Show quote
> Hey,.. I have a problem with dynamicly loaded assemblies, it can't resolve
> the types.
> In the main app i have a reference to a 'toolkit' dll containing IFunky and
> class Funky : IFunky.
> In a dynamicly loaded assembly I also have a reference to toolkit and
> another class called TooFunky : Funky.
>
> So in the main app I try to load this specialized class TooFunky as a type
> of Funky (also tried IFunky) by calling upon an utility class's method in the
> dynamicly loaded assembly and with the following signature like this:
> public Funky GetFunky()
> {
>     return new TooFunky();
> }
>
> And then I get :
> Type is not resolved for member 'MadeUpNamespace.TooFunky, TooFunky,
> Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
> System.Exception {System.Runtime.Serialization.SerializationException}
>
> The idea is to load specialized classes into the main app that support
> IFunk's interface.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

See http://www.pobox.com/~skeet/csharp/plugin.html for a (very) brief
introduction to this *kind* of thing.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

AddThis Social Bookmark Button