[IronPython] Debugging support PythonEngine

J. Merrill jvm_cop at spamcop.net
Fri Aug 18 06:43:52 CEST 2006

Without looking at the IP source, can we be confident that the same IL is produced when a DynamicMethod is created as when AssemblyBuilder is used?  Do the test cases get run with both settings of Options.GenerateDynamicMethods?

One of the most frustrating debugging problems is when code fails when running "normally", but works when attempting to debug, due to the code being generated differently in the two situations.

I have not heard anyone else worry out loud that e.g. the code running when using the console seems to be different than what is obtained using the IronPython.Compiler, etc.  How concerned should we be when we learn that the code paths are very different?

At 05:49 PM 8/17/2006, Shri Borde wrote
>The first issue is probably the same that IL offset 0 does not have any debug information.
>Calling the delegate “add” steps into a DynamicMethod which confuses VS. A workaround for now is to add this statement before creating the PythonEngine.
>IronPython.Compiler.Options.GenerateDynamicMethods = false;
>This disabled the use of DynamicMethods altogether and will instead use AssemblyBuilder. This is not generally recommended or supported since you are going to leak memory since AssemblyBuilder memory cannot be reclaimed. However, VS seems to be better able to deal with AssemblyBuilder during stepping, and it might be good enough for you. This is a case where we will would need to teach the tool (VS) to handle DynamicMethods differently than it currently does.

J. Merrill / Analytical Software Corp

More information about the Ironpython-users mailing list