[IronPython] Question about Visual Studio & IronPython Toolsand Debugging

Dino Viehland dinov at microsoft.com
Wed Sep 1 19:00:39 CEST 2010


If you'd like to store the scripts in a database and allow the user to have
scripts reference each other the one thing that you'll probably want to do 
next is implement a PlatformAdaptationLayer to virtualize the file system.
You can look at the Silverlight host to see how that's done but it basically
it involes subclassing both PlatformAdaptationLayer and ScriptHost (to 
provide your PAL subclass).

The having VS save to the database part might be trickier.  It seems like you'd
at least need a plugin to VS to know when the files are getting saved and that's
not something I know how to do off the top of my head.  One extreme solution
might be to plug into VS's source control mechanisms but I'm guessing that's
not easy.  If you're starting VS on the behalf of the user it might be easy
enough to have another program which has a FileSystemWatcher watching the
project and propagating changes.


> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of Marty Nelson
> Sent: Wednesday, September 01, 2010 9:53 AM
> To: Discussion of IronPython
> Subject: Re: [IronPython] Question about Visual Studio & IronPython Toolsand
> Debugging
> 
> 
> That will work fine.  I can create a config parameter in our application
> (or maybe tie into log4net IsDebugEnabled) and we can change how we
> invoke ScriptEngine.
> 
> Next piece of the puzzle is about to manage scripts themselves.  We
> currently have rich text editors within the application that directly
> store code as string.  I'm thinking we need to move to more of a script
> library approach where application references scripts that have been
> stored to a database.  This would mean user experience is to use IPy VS
> and we would need some VS add-in to save those files to our db behind
> the scene.
> 
> Any thoughts or experiences appreciated.
> 
> -----Original Message-----
> From: users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
> Sent: Wednesday, September 01, 2010 9:49 AM
> To: Discussion of IronPython
> Subject: Re: [IronPython] Question about Visual Studio & IronPython
> Toolsand Debugging
> 
> Yep you'll need to write it out to a file and then create the
> ScriptSource
> object using the file instead of the in-memory stream.  The filename
> will
> then be carried along w/ the ScriptSource and when the debugging
> information
> is emitted it will be emitted w/ that filename so the debugger can pick
> it
> up.
> 
> Also you won't want to always leave debugging mode on - it's much slower
> to
> compile the code in debugging mode than it is in normal mode.  I'd like
> to
> eventually start supporting sys.settrace style debugging which won't
> have
> this penalty but that won't happen anytime soon.
> 
> > -----Original Message-----
> > From: users-bounces at lists.ironpython.com [mailto:users-
> > bounces at lists.ironpython.com] On Behalf Of Marty Nelson
> > Sent: Wednesday, September 01, 2010 9:44 AM
> > To: Discussion of IronPython
> > Subject: Re: [IronPython] Question about Visual Studio & Iron Python
> Toolsand
> > Debugging
> >
> >
> > Setting DebugMode seems easy enough.
> >
> > The script code is loaded from an in-memory string.  Would we need to
> > write it out to temp file first for debug case?  How does debugger
> > "know" what source is?
> >
> > Thx
> >
> > -----Original Message-----
> > From: users-bounces at lists.ironpython.com
> > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
> > Sent: Wednesday, September 01, 2010 9:29 AM
> > To: Discussion of IronPython
> > Subject: Re: [IronPython] Question about Visual Studio & Iron Python
> > Toolsand Debugging
> >
> > The scripts need to be started in debug mode and be stored in files
> > somewhere on disk (so Visual Studio can load the source code).  To
> > enable
> > debug mode you can set the DebugMode property on the
> ScriptRuntimeSetup
> > object.
> >
> > So this ends up looking like:
> >
> > var setup = Python.CreateRuntimeSetup();
> > setup.DebugMode = true;
> > var runtime = new ScriptRuntime(setup);
> >
> > Alternately can also pass in "Debug" = true to the IDictionary<string,
> > object> when
> > creating a Python engine:
> >
> > var dict = new Dictionary<string, object>();
> > dict["Debug"] = true;
> > Python.CreateEngine(dict);
> >
> > When you attach all of the Python code should be debuggable.
> >
> >
> > > -----Original Message-----
> > > From: users-bounces at lists.ironpython.com [mailto:users-
> > > bounces at lists.ironpython.com] On Behalf Of Marty Nelson
> > > Sent: Wednesday, September 01, 2010 8:42 AM
> > > To: Discussion of IronPython
> > > Subject: [IronPython] Question about Visual Studio & Iron Python
> Tools
> > and
> > > Debugging
> > >
> > >
> > > How does debugging work when attaching to a process with IPy Tools
> in
> > > Visual Studio?
> > >
> > > Can I attach to an .NET application that has extension points that
> go
> > > into ScriptEngine and "debug" the Python scripts?
> > >
> > > =======
> > > Notice: This e-mail message, together with any attachments, contains
> > > information of Symyx Technologies, Inc. or any of its affiliates or
> > > subsidiaries that may be confidential, proprietary, copyrighted,
> > > privileged and/or protected work product, and is meant solely for
> > > the intended recipient. If you are not the intended recipient, and
> > > have received this message in error, please contact the sender
> > > immediately, permanently delete the original and any copies of this
> > > email and any attachments thereto.
> > > _______________________________________________
> > > Users mailing list
> > > Users at lists.ironpython.com
> > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> > _______________________________________________
> > Users mailing list
> > Users at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> > =======
> > Notice: This e-mail message, together with any attachments, contains
> > information of Symyx Technologies, Inc. or any of its affiliates or
> > subsidiaries that may be confidential, proprietary, copyrighted,
> > privileged and/or protected work product, and is meant solely for
> > the intended recipient. If you are not the intended recipient, and
> > have received this message in error, please contact the sender
> > immediately, permanently delete the original and any copies of this
> > email and any attachments thereto.
> > _______________________________________________
> > Users mailing list
> > Users at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 
> =======
> Notice: This e-mail message, together with any attachments, contains
> information of Symyx Technologies, Inc. or any of its affiliates or
> subsidiaries that may be confidential, proprietary, copyrighted,
> privileged and/or protected work product, and is meant solely for
> the intended recipient. If you are not the intended recipient, and
> have received this message in error, please contact the sender
> immediately, permanently delete the original and any copies of this
> email and any attachments thereto.
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list