ironpython2
ironpython2 copied to clipboard
When hooking the AssemblyResolve function in a secondary AppDomain, IPY throws a StandardError
Description
When hooking the AssemblyResolve
function in a secondary AppDomain, IPY throws a StandardError
Steps to Reproduce
This was done directly in the IPY interepreter
>>> from System import AppDomain
>>> def handler(s,e):
... return None
>>> AppDomain.CurrentDomain.AssemblyResolve += handler # this works
>>> ad = AppDomain.CreateDomain("test")
>>> ad.AssemblyResolve += handler # this doesn't
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StandardError: Exception has been thrown by the target of an invocation.
Versions
IronPython 2.7.9 2.7.9.0 on .NET 4.0.30319.42000
Haven't got a clue about this one... Here's the .NET trace:
>>> AppDomain.add_AssemblyResolve(ad, handler)
Cannot serialize delegates over unmanaged function pointers, dynamic methods or methods outside the delegate creator's assembly.
at System.MulticastDelegate.GetObjectData(SerializationInfo info, StreamingContext context)
at System.Runtime.Serialization.ObjectCloneHelper.GetObjectData(Object serObj, String& typeName, String& assemName, String[]& fieldNames, Object[]& fieldValues)
at System.AppDomain.add_AssemblyResolve(ResolveEventHandler value)
at Microsoft.Scripting.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run5[T0,T1,T2,T3,T4,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run5[T0,T1,T2,T3,T4,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
at IronPython.Compiler.Ast.CallExpression.Invoke2Instruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at IronPython.Hosting.PythonCommandLine.<>c__DisplayClass27_0.<RunOneInteraction>b__0()