Windows Service: Get wrong type from dynamically loaded dll?

Windows Service: Get wrong type from dynamically loaded dll?

am 09.01.2008 08:19:23 von bredesec

Hi

I am writing a windows service which, at some point, does a dynamic
compilation of a c# class into a dll, loads the dll in another AppDomain,
makes a call to a method within the compiled class and process the returned
object.

However, it gives me the base type of System.MarshalByRefObject on:
_obj = _domain.CreateInstanceFromAndUnwrap(file, "Scripts.MyClass");

_type = _obj.GetType(); <----
System.MarshalByRefObject type returned instead of Scripts.MyClass

The weird thing is that the same code works fine within a Windows
Application! I have been stuck with this for 2 days now :( Anybody has an
idea what is going on?

Thanks
Jeff

Re: Windows Service: Get wrong type from dynamically loaded dll?

am 10.01.2008 08:56:02 von bredesec

Any help please?

"news.microsoft.com" a écrit dans le message de news:
OqmkhdoUIHA.5360@TK2MSFTNGP03.phx.gbl...
> Hi
>
> I am writing a windows service which, at some point, does a dynamic
> compilation of a c# class into a dll, loads the dll in another AppDomain,
> makes a call to a method within the compiled class and process the
> returned object.
>
> However, it gives me the base type of System.MarshalByRefObject on:
> _obj = _domain.CreateInstanceFromAndUnwrap(file, "Scripts.MyClass");
>
> _type = _obj.GetType(); <----
> System.MarshalByRefObject type returned instead of Scripts.MyClass
>
> The weird thing is that the same code works fine within a Windows
> Application! I have been stuck with this for 2 days now :( Anybody has an
> idea what is going on?
>
> Thanks
> Jeff