[IronPython] IronPython support In Visual Studio 2005 April VSSDK?

Dino Viehland dinov at exchange.microsoft.com
Fri Jun 2 16:48:16 CEST 2006


On debugging:
                Are you debugging running the console, or did you put the code into a .py file and run it?

                The reason I ask is when you're running at the console we generate code in a mode that is essentially un-debuggable.  The reason for this is that it's the only way the code is collectible by the GC.  But if you put the code into a .py file and import it, then you'll get a much better experience - you should be able to step through the code at that point.

                As for getting the IronPython source files - you might be able to solve this using Just My Code (Tools->Options->Debugging->General->Enable Just My Code).  Another option is tweaking the exception handling settings (Ctrl-Alt-E) so thrown CLR exceptions don't cause you to break in.

                You could point VS at the IronPython source code, but then you'd be stepping through tons of IP source code to understand your exception.  So hopefully the Just My Code option will do the right thing for you.


From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lesley & Mitch Barnett
Sent: Friday, June 02, 2006 4:15 AM
To: 'Discussion of IronPython'
Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK?

Fixed my own error:

>>> from System.Reflection import *
>>> a = Assembly.LoadFrom("mapack.dll")
>>> Types = a.GetTypes()
>>> for Type in Types:
...   print Type
...
Mapack.CholeskyDecomposition
Mapack.EigenvalueDecomposition
Mapack.LuDecomposition
Mapack.Matrix
Mapack.QrDecomposition
Mapack.SingularValueDecomposition
>>>

Still have the VS debugging issue...

________________________________
From: Lesley & Mitch Barnett [mailto:mbarnett at uniserve.com]
Sent: June 1, 2006 10:24 AM
To: 'Discussion of IronPython'
Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK?

Here is the code in the interpreter to show Types in Types: does work or is it a bug?

IronPython 1.0.2328 (Beta) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> from System.Reflection import *
>>> a = Assembly.LoadFrom("mapack.dll")
>>> Types = a.GetTypes()
>>> for Type in Types:
...   print Types
...
System.Type[]
System.Type[]
System.Type[]
System.Type[]
System.Type[]
System.Type[]


>>> Types = a.GetTypes()
>>> for Types in Types:
...   print Types
...
Mapack.CholeskyDecomposition
Mapack.EigenvalueDecomposition
Mapack.LuDecomposition
Mapack.Matrix
Mapack.QrDecomposition
Mapack.SingularValueDecomposition
>>>



Also, when running the debugger in VS, when it gets to the break point, it asks for the IronPython source code at: "z:\IronPython\Public\Src\IronPython\Runtime\FunctionEnvironment.cs"

Should I be pointing something in VS at the IronPython source code?  Or is this a bug?

Thanks,

Mitch

________________________________
From: Dino Viehland [mailto:dinov at exchange.microsoft.com]
Sent: May 30, 2006 8:44 AM
To: Discussion of IronPython
Subject: Re: [IronPython] IronPython support In Visual Studio 2005 April VSSDK?

The two files that you see is being done through partial class support which is a language feature that both C# & VB support.  Python doesn't have such a feature, and so we've been discussing internally ways we could do this - unfortunately we haven't come up with the ideal solution yet.

Ultimately we want to have a very similar experience to C# & VB, but it certainly may not be the same.  I believe our next round of VS integration work will enable the drop-down list for types & members.  Debugging should work today, although you won't get the greatest display for your locals or classes always - but you can at least step through.  I don't believe we have any specific plans to improve debugging immediately.

You should be able to place your code anywhere in Form1.py.  The CodeDom parser should just merge generated code in along w/ your code.  If you run into any issues there let us know J.

Is the issue w/ the code the one Vagmi pointed out (types in types)?  This should work.  One suggestion would be to look in the Data property of the exception, and find the Python version of the exception - it may contain more meaningful information.


From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lesley & Mitch Barnett
Sent: Tuesday, May 30, 2006 5:02 AM
To: users at lists.ironpython.com
Subject: [IronPython] IronPython support In Visual Studio 2005 April VSSDK?

Hi, using the April 2005 VSSDK, I am able fire up a new Visual Studio PythonProject (Experimental Hive) using the Windows Application template.  I can drag and drop UI controls from the Toolbox onto the design surface.  However, I notice the IronPython code being generated for both the designer and the form is placed in a single file called Form1.py.  In a C# WinForm project, the code is separated into 2 files, Form1.cs and From1.Designer.cs.

Is the plan to have IronPython fully integrated into Visual Studio in the same way as a C# project, including drop down list for types and members in the code editor?  What about debugger support?

I ask this as I am trying to build a simple IronPython Windows app and while being new to the Python language I am also finding it difficult to figure out exactly where I put my code in Form1.py cause the both the design code and "regular" code are in one place instead of separated as in a C# project.

Finally, I cannot get some simple code to work as it throws an exception, "A first chance exception of type IronPython.Runtime.ArgumentTypeException' occurred in IronPython.dll.  When I set the breakpoint to step through the code I get into disassembly and I am not good at reading IL.  Then the program aborts with the error above.

My project is real simple, has a Windows form and a listBox control.  All I am doing is using System.Reflection to GetTypes from a DLL and put them in a listBox.

In C# it looks like:

private void GetMyTypes()
        {
            Assembly myAssembly = System.Reflection.Assembly.LoadFrom("mapack.dll");
            Type[] types = myAssembly.GetTypes();
            foreach (Type type in types)
            {
                listBox1.Items.Add(type);
            }
        }

In IronPython:


 def GetMyTypes():
     myAssembly = System.Reflection.Assembly.LoadFrom("mapack.dll")
     types = myAssembly.GetTypes()
     for types in types:
       _listBox1.Items.Add(types)

In both cases, the method is being called right after InitializeComponent()

Any ideas as to why this IronPython code won't run?

Thanks in advance,

Mitch
http://softwareindustrialization.com<http://softwareindustrialization.com/>




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060602/65bdff72/attachment.html>


More information about the Ironpython-users mailing list