Windows Service: Get wrong type from dynamically loaded dll?

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

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
 
Back
Top