Regression in 0.91 with Invoke

May 23, 2009 at 9:33 PM

The following code doesn't crash in DLR 0.90, but does in 0.91:

import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("IronPython")
from System.Windows.Forms import Form
from IronPython.Compiler import CallTarget0
root = Form()
root.Show()
root.Invoke(CallTarget0(lambda: 42))

Here is the traceback from my own host:

Traceback (most recent call last):
  File "System.Windows.Forms", line unknown, in Invoke
  File "System.Windows.Forms", line unknown, in Invoke
  File "System.Windows.Forms", line unknown, in MarshaledInvoke
  File ...
StandardError: Parameter count mismatch.

This also occurs in the DLR-0.91 ipy.exe. Is there a known work-around? Thanks for any pointers!

-Doug

Coordinator
May 23, 2009 at 9:52 PM

My guess is this is because CallTarget0 may be different in 0.91.  This is fixed in the latest IronPython drops but it was temporarily changed.

You should be able to use the normal .NET Func[object] delegate type instead of CallTarget0.

From: dsblank [mailto:notifications@codeplex.com]
Sent: Saturday, May 23, 2009 1:34 PM
To: Dino Viehland
Subject: Regression in 0.91 with Invoke [dlr:57284]

From: dsblank

The following code doesn't crash in DLR 0.90, but does in 0.91:

import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("IronPython")
from System.Windows.Forms import Form
from IronPython.Compiler import CallTarget0
root = Form()
root.Show()
root.Invoke(CallTarget0(lambda: 42))

Here is the traceback from my own host:

Traceback (most recent call last):
File "System.Windows.Forms", line unknown, in Invoke
File "System.Windows.Forms", line unknown, in Invoke
File "System.Windows.Forms", line unknown, in MarshaledInvoke
File ...
StandardError: Parameter count mismatch.

This also occurs in the DLR-0.91 ipy.exe. Is there a known work-around? Thanks for any pointers!

-Doug

Read the full discussion online.

To add a post to this discussion, reply to this email (dlr@discussions.codeplex.com)

To start a new discussion for this project, email dlr@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

May 24, 2009 at 4:55 PM

Thanks! Specifically, here is what I had to add:

clr.AddReference("Microsoft.Scripting.Core")
from Microsoft import Func

and change:

root.Invoke(CallTarget0(lambda: 42))

to:

root.Invoke(Func[object](lambda: 42))