Monday, 1 September 2014

O2Platform question on 'Interactive development with Visual Studio'

Here is a reply I posted today to the O2 Platform Mailing list regarding a question about 'How to use O2 inside VisualStudio and WPF support' (with lots of links to code samples and blog posts)



Hi Chris, I'm glad you found the O2 Platform, specially since it looks like it already have the main features you are looking for :)

The key concept used across the main O2 Platform (and FluentSharp) APIs is the REPL (Read Eval Print Loop), which should be very common to you (btw you can run .Net's version of Lisp via this O2 script : Util - Clojure-clr REPL (Lisp).h2 )

Assuming you are running VS2010 and have installed this VS Extension (VisualStudio C# REPL - O2 Platform (v5.1)), see my comments below

On 1 September 2014 11:24, Chris Kim <chrisk414@gmail.com> wrote:

Hi, I just learned about O2 platform and I'm very excited about thinking that I could possibly do C# interactive development within Visual Studio.
This is something I've been dreaming about for a long time (I have background in CommonLisp where interactive development is the norm)

I downloaded the VS plugin but there are very little documentation to figure out how to use.

For this type of O2 functionality your best best for O2 Documentation is my blog http://blog.diniscruz.com/search/label/O2%20Platform (221 post) and the http://o2platform.wordpress.com/ blog (100+ posts)
My questions are below.

1. Can I intereactively develop the current solution file I loaded into Visual Studio from C# Repl?

Yes, that is exactly the point of that VS extension (to interact in real time with the VS)

Here are a number of posts written about using O2 inside VisualStudio (ordered by post data (with older first)):
The last ones have real examples of how I used that REPL and the FluentSharp APIs to make me more productive as an .NET developer inside VisualStudio

2. If so, changing source code without stopping the running instance will dynamically compile?

You can achieve this kind of 'dynamic code compilation without stopping the running instance' using the O2 REPL kind of development (which is the one I used to create all the O2 tools and APIs you see in there.

But if you are using VisualStudio to compile and run your app, you will find that you can't touch the dlls (since they are locked by VS). The key to achieve what (I think) you want to do, is to find a way to run your 'code/WPF-Control' in isolation (a bit like what I did here Real-time Programming C# WinForms Controls in VisualStudio's IDE (i.e. without using F5) ). Btw, if you haven't checkout NCrunch, you should since it makes a massive difference in TDD development (see my posts on it here http://blog.diniscruz.com/search/label/NCrunch)
3. WPF is my choice of desktop UI. Are there some support for WPF? (It seems like WinForm is the default)

There is quite already a lot of WPF support in O2's Apis. For example see http://blog.diniscruz.com/2013/04/winforms-webbrowser-running-inside-wpf.html


WPF support is not as mature as WinForms, but you should be able to find a lot of good stuff in there. 

Can you give me an example of what you would like to do?
4. Is it possible to show us some examples?

The links above should give you quite a lot of code samples, but the best way is, if you give me a more specific example of what you are trying to, I can write a blog post about with it :)


The code for the VS 2010 extension is at https://github.com/o2platform/FluentSharp.VisualStudio

The key part of the extension (and the bit that allows the real time programming of the VS UI) is the capture of these native VS objects/events: https://github.com/o2platform/FluentSharp.VisualStudio/blob/master/FluentSharp.VisualStudio_2010/VisualStudio_2010.cs#L17 (which you have real-time programmatically access from the O2 REPL running inside VS)
5. If above answers to above questions are no, is it on the roadmap for the near future?

Well here are the areas where we need help at the moment https://github.com/o2platform/FluentSharp/issues , namely this one for running that Extension in VS 2013: https://github.com/o2platform/FluentSharp.VisualStudio/issues 

Btw which version of O2 are you using, this one OWASP O2 Platform 5.5 - RC1 , please give it a test drive has the most updated APIs (also check out some of those doc links)

Thank you very much.

No worries, and it would be great if you could let us know (or write a blog post about it) how you are trying to use O2 , specially which links/docs really helped you (as you can see, a big issue with O2/FluentSharp is the lack of documentation for new users (like you))

Best regards

Dinis Cruz