[IronPython] IronPython kills CLR

Dino Viehland dinov at exchange.microsoft.com
Fri Jan 13 21:56:55 CET 2006

Sorry for the delayed response - this is the same issue we're seeing with code not working properly at the console.  What's happening here is that we are making a call into TryGetLocal and passing in a variable of the wrong type (we end up passing in an instance of your Rectangle1 class but expect an instance of the Frame class where we can find the dictionary).

This was introduced by the changes to cleanup the leaks.  It is something that we're actively working on fixing.  

One workaround would be to include:

if(False): locals()

inside of __init__ (as this will prevent us from creating a dynamic method for this method).  It's ugly, but it might unblock you for beta 1 and shouldn't have any cost other than the check for the if false.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Szymon Kobalczyk
Sent: Thursday, January 12, 2006 11:05 PM
To: s.kobalczyk at softwaremind.pl; Discussion of IronPython
Subject: Re: [IronPython] IronPython kills CLR

Did you receive my last email? Have you been able to reproduce this 
issue? Please let me know how to avoid this bug (I don't want to blow up 
my application with some script by incident).


Szymon Kobalczyk wrote:

>I finally found why my NUnit suite doesnt work anymore. It occurs that 
>its caused by following test case:
>            string script = @"
>class Rectangle1(object):
>    def __init__(self, width, height):
>        self.width = width
>        self.height = height
>    def getArea(self):
>        return self.width * self.height
>    area = property(getArea, None, None, None)
>r = Rectangle1(10, 100)
>print r.area";
>            PythonEngine engine = new PythonEngine();
>            object code = engine.Compile(script);
>            engine.Execute(code);
>Executing this in NUnit just kills the process with no error. When I 
>execute it with debugger I get following exception:
> >    IronPython.dll!IronPython.Runtime.Frame.TryGetLocal(string name = 
>"property", out object ret = null) Line 65 + 0x12 bytes    C#
>     IronPython.dll!IronPython.Runtime.Frame.GetGlobal(string name = 
>"property") Line 90 + 0xe bytes    C#
>     snippets.dll!moduleHolder_0.Rectangle1$maker0() + 0x158 bytes   
>     snippets.dll!moduleHolder_0.input() + 0xb6 bytes   
>frame = {IronPython.Runtime.Frame}) Line 165 + 0xd bytes    C#
>FatalExecutionEngineError was detected
>Message: The runtime has encountered a fatal error. The address of the 
>error was at 0x79e7bd7e, on thread 0xc04. The error code is 0xc0000005. 
>This error may be a bug in the CLR or in the unsafe or non-verifiable 
>portions of user code. Common sources of this bug include user 
>marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
>If I execute the same script using IronPythonConsole it works fine. 
>Please confirm if this issue would occur only when we use python 
>properties (hopefully we don't have any yet in production code) or there 
>are other cases to avoid.
>Szymon Kobalczyk.
>users mailing list
>users at lists.ironpython.com

users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list