IronLanguages / main

Work for this repo has moved to https://github.com/IronLanguages/ironpython2
1.16k stars 350 forks source link

test_ipyc.test_cached_types failed throwing SystemError under .NET 4.0 Beta #742

Open ironpythonbot opened 9 years ago

ironpythonbot commented 9 years ago

In short, we can no longer add references to DLLs containing compiled subclass types for CLR exceptions and IronPythonTest.EngineTest under .NET 4.0.

C:\vsl\Merlin\Main\Languages\IronPython\Tests>ipyd
IronPython 2.6 Beta 2 DEBUG (2.6.0.20) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.

import clr
import System
clr.AddReference("IronPythonTest")
import IronPythonTest

x = 0
for name in dir(IronPythonTest):
... attr = getattr(IronPythonTest, name)
... if type(attr) is type:
... clrType = clr.GetClrType(attr)
... if clrType.IsEnum or clrType.IsSealed or clrType.IsValueType or clrType.ContainsGenericParameters: continue
... x += 1
... clr.CompileSubclassTypes('InheritanceTypes%d' % x, [attr])
... try:
... clr.AddReference('InheritanceTypes%d' % x)
... except:
... print "FAIL", attr
...

^Z

C:\vsl\Merlin\Main\Languages\IronPython\Tests>copy %Userprofile%\Desktop\ipy.exe.config.40 %ROWAN_BIN%\ipy.exe.config
Overwrite C:\vsl\Merlin\Main\bin\Debug\ipy.exe.config? (Yes/No/All): yes

    1 file(s) copied.

C:\vsl\Merlin\Main\Languages\IronPython\Tests>ipyd
IronPython 2.6 Beta 2 DEBUG (2.6.0.20) on .NET 4.0.20826.1
Type "help", "copyright", "credits" or "license" for more information.

import clr
import System
clr.AddReference("IronPythonTest")
import IronPythonTest

x = 0
for name in dir(IronPythonTest):
... attr = getattr(IronPythonTest, name)
... if type(attr) is type:
... clrType = clr.GetClrType(attr)
... if clrType.IsEnum or clrType.IsSealed or clrType.IsValueType or clrType.ContainsGenericParameters: continue
... x += 1
... clr.CompileSubclassTypes('InheritanceTypes%d' % x, [attr])
... try:
... clr.AddReference('InheritanceTypes%d' % x)
... except:
... print "FAIL", attr
...
FAIL <type 'CLRException1'>
FAIL <type 'CLRException2'>
FAIL <type 'CLRException3'>
FAIL <type 'CLRException4'>
FAIL <type 'EngineTest'>

REPRO

C:\vsl\Merlin\Main\Languages\IronPython\Tests>%ROWAN_BIN%\ipy.exe
IronPython 2.6 Beta 2 DEBUG (2.6.0.20) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.

types = []
import clr
import System
clr.AddReference("IronPythonTest")
import IronPythonTest
for name in dir(IronPythonTest):
... attr = getattr(IronPythonTest, name)
... if type(attr) is type:
... clrType = clr.GetClrType(attr)
... if clrType.IsEnum or clrType.IsSealed or clrType.IsValueType or clrType.ContainsGenericParameters: continue
... types.append(attr)
...
clr.CompileSubclassTypes('InheritanceTypes', *types)
clr.AddReference('InheritanceTypes')
^Z

C:\vsl\Merlin\Main\Languages\IronPython\Tests>copy %Userprofile%\Desktop\ipy.exe.config.40 %ROWAN_BIN%\ipy.exe.config
Overwrite C:\vsl\Merlin\Main\bin\Debug\ipy.exe.config? (Yes/No/All): yes

    1 file(s) copied.

C:\vsl\Merlin\Main\Languages\IronPython\Tests>%ROWAN_BIN%\ipy.exe -X:ExceptionDetail
IronPython 2.6 Beta 2 DEBUG (2.6.0.20) on .NET 4.0.20826.1
Type "help", "copyright", "credits" or "license" for more information.

types = []
import clr
import System
clr.AddReference("IronPythonTest")
import IronPythonTest
for name in dir(IronPythonTest):
... attr = getattr(IronPythonTest, name)
... if type(attr) is type:
... clrType = clr.GetClrType(attr)
... if clrType.IsEnum or clrType.IsSealed or clrType.IsValueType or clrType.ContainsGenericParameters: continue
... types.append(attr)
...
clr.CompileSubclassTypes('InheritanceTypes', *types)
clr.AddReference('InheritanceTypes')
Exception has been thrown by the target of an invocation.
_InvokeMethodFast at offset 0 in file:line:column :0:0

InvokeMethodFast at offset 72 in file:line:column :0:0

Invoke at offset 303 in file:line:column :0:0

Invoke at offset 28 in file:line:column :0:0

Invoke at offset 19 in file:line:column :0:0

LoadNewTypes at offset 263 in file:line:column c:\vsl\Merlin\Main\Languages\IronPython\IronPython\Runtime\Types\NewTypeMaker.

DomainManager_AssemblyLoaded at offset 897 in file:line:column c:\vsl\Merlin\Main\Languages\IronPython\IronPython\Runtime\Biner.cs:849:13

LoadAssembly at offset 171 in file:line:column c:\vsl\Merlin\Main\Runtime\Microsoft.Scripting\Runtime\ScriptDomainManager.cs:

AddReference at offset 65 in file:line:column c:\vsl\Merlin\Main\Languages\IronPython\IronPython\Runtime\ClrModule.cs:305:13

AddReference at offset 298 in file:line:column c:\vsl\Merlin\Main\Languages\IronPython\IronPython\Runtime\ClrModule.cs:330:13

AddReference at offset 162 in file:line:column c:\vsl\Merlin\Main\Languages\IronPython\IronPython\Runtime\ClrModule.cs:297:17

AddReference at offset 247 in file:line:column c:\vsl\Merlin\Main\Languages\IronPython\IronPython\Runtime\ClrModule.cs:75:17

at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, Boolean& shouldOptimize) in c:\vsl\Merlin\
crosoft.Scripting\Actions\Calls\MethodCandidate.cs:line 368
at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller 2.Call1(CallSite site, CodeContext context, TFuncType fu c:\vsl\Merlin\Main\Languages\IronPython\IronPython\Runtime\Types\BuiltinFuncti on.Generated.cs:line 218 at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) in c:\vsl\ndp crosoft\Scripting\Actions\UpdateDelegates.Generated.cs:line 509 at Microsoft.Scripting.Interpreter.DynamicInstruction 4.Run(InterpretedFrame frame) in c:\vsl\Merlin\Main\Runtime\Microsof
erpreter\DynamicInstructions.Generated.cs:line 143
at Microsoft.Scripting.Interpreter.Interpreter.RunInstructions(InterpretedFrame frame) in c:\vsl\Merlin\Main\Runtime\Micro
Interpreter\Interpreter.cs:line 233
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) in c:\vsl\Merlin\Main\Runtime\Microsoft.Scripti
Interpreter.cs:line 75
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) in c:\vsl\Merlin\Main\Runtime\Microsoft.
preter\LightLambda.Generated.cs:line 93
at IronPython.Compiler.PythonScriptCode.RunWorker(Scope scope) in c:\vsl\Merlin\Main\Languages\IronPython\IronPython\Compi
tCode.cs:line 75
at IronPython.Compiler.PythonScriptCode.Run(Scope scope) in c:\vsl\Merlin\Main\Languages\IronPython\IronPython\Compiler\Py
cs:line 66
at IronPython.Hosting.PythonCommandLine.<>cDisplayClass1. b0() in c:\vsl\Merlin\Main\Languages\IronP
n\Hosting\PythonCommandLine.cs:line 390
at PythonCachedTypeConstructor.GetTypeInfo()
StandardError: Exception has been thrown by the target of an invocation.

Work Item Details

Original CodePlex Issue: Issue 24509 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Sep 1, 2009 at 5:19 PM Reported by: dfugate Updated on: Oct 20 at 2:09 PM Updated by: slide_o_mix Test: test_ipyc.py (test_cached_types)

ironpythonbot commented 9 years ago

On 2014-10-20 21:09:26 UTC, slide_o_mix commented:

I don't get the same issue with the latest code. I get the following:

TypeError: : unsupported base type for new-style class Microsoft.Scripting.Actions.NamespaceTracker:IronPythonTest.BinderTest