Category Archives: Tools

PDC09 : How VS2010 was built with WPF ?

PDC09

In my last blog post, I did a review of a PDC09 Session “Advanced performance tuning with WPF”. Today, I’m doing a review for another very interesting session “How VS2010 was built with WPF ?”. The video is available here.

vs2008tovs2010

Why did Microsoft choose WPF for VS2010 ?

  • Technological: prove the capabilities of WPF4
  • Architectural
    • Separated presentation
    • Support for long range road map (+10 years)
  • Key VS2010 features need it: Editor, Architecture Editor, Parallel tools debugging
  • Take an opportunity to give feedback for WPF4: when VS2010 development started, .Net 3.5 SP1 was just shipped and it was the right time to give feedback for the new features and fixes for WPF4.

It is worth noting that VS2010 is a project that is being watched carefully inside Microsoft. We can expect that more Microsoft applications will move to WPF in the next coming years.

What WPF features are used ?

  • Declarative UI using XAML
  • Databinding
  • Styles and templates
  • Application Resources
  • Interop Win32 (because they did not have the time to rewrite everything using WPF or because features doest not need to use WPF for example de WinForms designer…)
  • Integration with the message loop (to deal with particular focus issues)
  • New text stack (part of WPF4) based on DirectWrite

Staged approach

  • Define data models: a huge diagramming and architectural exercice
  • Replace the main window with WPF (only the window not its content !) to start the mix approach (managed/unmanaged, WPF/Hwnds)
  • Write new managed components: Window manager, command bar presentation
  • Scout with other VS teams
  • Test, Test, Test…

What were the challenges ?

  • Mixed mode application: native and managed code; WPF and HWNDs (Win32 or WinForms)
  • Keep existing extensions working and allow new extensions to take advantage of WPF
  • Don’t “stop the train” other teams were working at the same time on the product to add new functionalities
  • Text clarity
  • Performance
  • Focus management

You can watch the session here if you want more detail and demos of what I mention in this post.

Analyzing events usage using a R# plugin

As you might already know, even if the .Net framework has a garbage collector, you can easily create memory leaks in your application.

The most common way to create a leak is to register to an event handler on a object that has a longer lifetime than the object where the handler is defined. The problem can also occurs by using static class such as EventManager (for more information see this blog post). Some .Net developers have been working on a way to go round the problem using Reflection, Weak Reference and other cool stuff. You can check out for example this excellent article on Code Project.

However, if you cannot change the way your declare events (because of internal policies in the company or because you don’t have the source code), you must be very carefull about the way you manage your events.

I’ve been working lately on a Resharper plugin that helps detecting events that are never unsubscribed. Basically, what is does is the following:

resharper_plugin

I’d like to have feedback from you .Net developpers, about whether you find such a plugin useful or not.

  • How do you deal with the event memory leak problem ?
  • Would you like to use my plugin ?
  • Would you like me to release it on a open source platform ?
  • What other kind of possible leaks are you thinking about to enhance the plugin ?

Please write a comment to let my know what you think. Thank you for your feedback !

.Net4, WPF4 and VS2010 interesting links

Since the release of VS2010 last week a lot of cool blog posts had been written. The thing is more than VS2010 itself, the Beta1 comes with .Net4 and WPF4 too, and that’s exciting too !

Because I didn’t have time yet to write my own feedback, I’m sharing some links I found the last couple of days.

Download

  • A full list of what is available to download (VS2010, .Net framework…) can be found here.

MSDN Documentations

  • .Net Framework4 Beta1: here
  • What’s new in .Net Framework4 Beta1: here
  • WPF4 Beta1: here
  • What’s new in WPF4 Beta1: here
  • VS2010 Beta1: here
  • What’s new in VS2010 Beta1: here

From Beta1 to Beta1 and RTM

  • Jaime Rodriguez wrote a very nice article today and share his “insider view” of what’s on the road to RTM.
  • Karl Shifflet explained on his blog what’s going to change in the DataBinding pipeline (no more dummy converter !)

Channel9

  • Interviews of WPF and Silverlight program managers.
  • Rob Releya is also talking on the new XAML stack available in the framework. More information can be found on his blog.

Other bloggers

And also, Blend3

  • Unni’s wrote an article about updates that had been made to Blend regarding user feedback on Connect.