Hi Dino,<br><br>If have tweaked your code to reproduce the exception that I am facing. Let me know if you need more details.<br><br>thanks,<br>Mustaq<br><br>using System;<br>using Microsoft.Scripting;<br>using IronPython.Hosting;<br>
using Microsoft.Scripting.Hosting;<br><br>class Foo<br>{<br> public static void Main(string[] args)<br> {<br> AppDomain ad = AppDomain.CreateDomain("foo");<br> var engine = Python.CreateEngine(ad);<br>
engine.Runtime.LoadAssembly(typeof(MbrBase).Assembly);<br><br> var code = engine.CreateScriptSourceFromString(@"<br>import MbrBase<br>class C(MbrBase):<br> pass<br><br>a = C()<br>", SourceCodeKind.Statements);<br>
<br> var scope = engine.CreateScope();<br> code.Execute(scope);<br><br> Console.WriteLine("Trying to do it... {0}", <a href="http://AppDomain.CurrentDomain.Id">AppDomain.CurrentDomain.Id</a>);<br>
MbrBase mbr = (MbrBase)scope.GetVariable("a");<br><br>// MY CHANGES<br><br> string isSubClassCode = String.Format("issubclass({0},{1})", "C", "MbrBase");<br> ScriptSource script = engine.CreateScriptSourceFromString(isSubClassCode, SourceCodeKind.Expression);<br>
bool result = (bool)script.Execute(scope);<br><br> if (result == true)<br> {<br> ObjectOperations ops = engine.Operations;<br><br> object subClass = scope.GetVariable("C");<br>
object instance = ops.Call(subClass);<br><br> mbr = instance as MbrBase; <br> }<br><br>// END OF MY CHANGE<br> <br> mbr.DoItVirtually();<br> mbr.DoIt();<br> Console.ReadKey();<br>
}<br>}<br><br>public class MbrBase : MarshalByRefObject<br>{<br> public virtual void DoItVirtually()<br> {<br> Console.WriteLine("Did it virtually {0}", <a href="http://AppDomain.CurrentDomain.Id">AppDomain.CurrentDomain.Id</a>);<br>
}<br> <br> public void DoIt()<br> {<br> Console.WriteLine("Did it {0}", <a href="http://AppDomain.CurrentDomain.Id">AppDomain.CurrentDomain.Id</a>);<br> }<br>}<br>