dynamicly loaded assemblies and types

G

Guest

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!
 
J

Jon Skeet [C# MVP]

DrBytes said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top