MVP in Client Application Development !

Events 5 Comments »

A couple of days ago I received an email telling me I got the MVP Award for 2010 ! I’ve been waiting a little bit before I wrote this post because I invited my coworkers at home in order to celebrate this yesterday and I wanted to keep the surprise :D

This is the very first year I got the MVP award. I’m very proud to have this recognition from Microsoft and it is giving me new ideas for the future. I started this blog almost 2 years ago now and I’d never imagine I’d get so much feedback about it. My MVP award is also recognizing my work in the French community (on the developpez.com website) or for conferences I’m giving in my daily job.

The MVP award will be also for me the occasion to have pre-release of Microsoft software (but I’ll not be able to publicly give information about them since I’ve just signed an NDA) and also to enjoy a free MSDN-Premium subscription !

For more information about the MVP Award Program you can check-out:

Thanks to all my readers also who are giving me feedback and support.  I’d also like to thank my co-workers who are helpful in my daily job. I’m very lucky to be part of this very nice team. By reading posts before they go public (Charlotte, Fred !) or discussion about software programming in general (the whole Pythagore group!) I get cool ideas about things I want to share. So thank you every one for supporting me :-)

[WP7] Windows Phone 7 challenge for french readers !

.Net, Events, Silverlight, Windows Phone No Comments »

A couple of months ago, the french programming website www.developpez.com organized an event to discover Windows Azure programming (I wrote a blog post about it here).

A similar event has just been launched for Windows Phone 7 development at challenge-windowsphone7.developpez.com

(tr: “Let’s go !” “World cup ?” “No… Windows Phone 7 challenge by developpez.com !”)

The challenge is made of 6 steps:

  1. Tools : download and install the required tools
  2. Quizz : first basic quizz
  3. Silverlight development
  4. Silverlight and push notifications
  5. XNA
  6. Quizz : advanced quizz

Each winner will have the following gifts:

This kind of challenge is really helpful to discover a new technology the funny way ! I hope I’ll get my “I Love Windows Phone” tee-shirt to wear it this summer :-)

Mix10 : first Windows Phone application using Blend4

Events, Silverlight, Windows Phone No Comments »

You’ll need not more than a couple of minutes to download and install all the tools needed to create your first Windows Phone application using Blend.

Here is a tour in images:

Welcome in Blend 4

Discovering new projects templates in the Welcome dialog:

It must be quite familiar to you if you’re working with WPF or Silverlight

Choosing a target

Launching the app in the emulator

App.xaml file has all the resources for the Windows Phone theme

Let’s go now and play with the tools :-)

Mix10: Windows Phone 7 series development tools available

Events, Silverlight, Tools, Windows Phone 1 Comment »

The first keynote of Mix10 is just over and the biggest announcement I was waiting for occured: Windows Phone 7 series development tools are NOW available for FREE.

Grab the tools right now ! You’ll need:

If you want more details about Blend4, you can check out Christian Schormann’s overview. A new website is now live for all Windows Phone 7 series related development information at http://developer.windowsphone.com/

Another announcements is the availability of Silverlight 4 RC and support for VS2010 RC:

For more information about Silverlight 4 RC, you can check out the blog post of Tim Heuer.

I can’t wait to play with all this new stuff. It’s very impressive to see the work done around Windows Phone 7 series. WPF and Silverlight developers just became Windows Phone developer today, and I think this is great !

I’ll give more feedback as soon as the tools will be installed :-)

Mix10 starting today !

.Net, Events, Silverlight, Visual Stutio No Comments »

Mix10 is starting today and we can expect many cool announcements during the keynote. You can watch the keynote online at live.visitmix.com. I’ll try to give feedback as soon as possible. Because I’m not lucky enough to be in Vegas, I’ll watch the keynote tonight (French time !) at home with some coworkers.

Last information before the keynote, it looks like we’ll have some announcements about Silverlight running on Symbian devices…

Mix10 is coming : Windows Phone 7 series sessions announced !

Events, Silverlight, Windows Phone No Comments »

Next monday, Mix10 will start in Las Vegas. Even though it’s a little bit far from my place here in France I’ll try to give feedback after the keynotes and as soon as first videos will be available. I’m sure you’re aware that major announcements this years at Mix will be about the Windows Phone 7 series.

To make the long story short :

I’m sure you realize that we are going to a very capable and powerful mobile platform here:

  • all existing .Net and Silverlight developers are going to be able to write apps for the Windows Phone (this is HUGE)
  • we are going to finally have the 3 screens version of Microsoft: develop once and then run on your mobile, your PC and your TV (XBox)

Mix10 website now contains the name and the description of the sessions which are dedicated to the Windows Phone 7 series:

If you’re using Twitter, make sure to watch the #wp7 hashtag. It make not any doubt the next week is going to be very informative about Windows Phone 7 series.So stay tuned !

Windows Azure challenge

Events 1 Comment »

A couple of weeks ago, the French developpez.com website launch a challenge in collaboration with Microsoft to help developers discover the Windows Azure platform.The goal was to succeed 5 different steps in order to win the challenge and get two prizes. The first one was a wifi teeshirt and the second one the new Microsoft Arc Mouse.

It was my first real experience with the Azure platform and I was very happy to be able to manipulate the platform through various real-world example. The steps were the following:

  1. Deploy an existing application on Azure
  2. Modify an existing application and then deploy it on Azure
  3. Deploy an existing application using Blob storage
  4. Fix a Winforms application using the Azure API to backup files and folder
  5. Answers several questions about the Azure platform

The steps were both educational (each time we discovered a new feature) and challenging (we must make it work !). I would like to thank very much the organizers of this event: Jérôme Lamber, Louis-Guillaume Morand, Phillippe Vialatte, Pierre Couzy and Thomas Lucchini.

Hopefully, we’ll see more challenges in the future on the developpez.com website.

PDC09 : How VS2010 was built with WPF ?

.Net, Events, Tools, Visual Stutio, WPF No Comments »

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.

PDC09: Advanced WPF Application Performance Tuning

Events, WPF 2 Comments »

PDC09

In this post, I’m doing a review of the Advanced WPF Application Performance Tuning session of PDC09.

1. Introduction

WPF = Designer + Developer:

  • Designer: Resources constraints, Drawing effects, Excessive use of images, “Rich” template
  • Developer: Loaded modules, Startup time (cold and warm time), Memory leaks (it’s not because we have a GC that leak doesn’t exist), Large element count

Performance general truth:

  • Measure, measure, measure (identify key scenarios and set clear goals)
  • Low hanging fruit: identify parts that need optimized (to avoid spending time on optimizations that will not be perceived by the user)
  • Perceived performance is the most important thing: make it feel fast
  • Trade-offs: CPU vs memory…

After this short intro, the speaker introduce FishBowl a sample WPF application that brings Facebook on our desktop. This app will be used as a reference in the rest of the session to demonstration optimization techniques.

fishbowl

2. Memory usage

The demonstration starts using Process Explorer to have a look at the memory usage of the app which is about 150MB. This seems quite high for such an application. By using VMMAP, the speaker finds out that the native heap is 100MB whereas the managed heap is only 50MB. This seems strange for a pure WPF application.

There is always native heap (render thread…), but when it’s particularly large, it’s generally related to images used in the application.

By browsing the source code of FishBowl, the speaker shows that the startup animation is not XAML based but uses more than 100 PNG images holding more than 30MB of memory (that will be in the native heap).

Using .Net memory profiler, the speaker finds out that the bitmap images used in the startup animation are not released when the animation is over causing a memory leak.

3. Cold Start

Cold start is all about disk I/O, we must minimize the amount of data that must be read from disk. The speaker shows that System.Window.Forms and System.Drawing assemblies are loaded during startup whereas it should not be the case for a pure WPF app (and about 300ms could be saved).

Then using the “Show hierarchical” feature of the .Net memory profiler, he finds out that System.Drawing only has 1 instanciated type (the Rectangle class !). By changing the code to remove those dependencies he prevents those 2 DLLs from loading in the startup process and improve the startup time !

Although by changing this code:

?View Code CSHARP
1
2
3
4
5
6
if(Properties.Settings.Default.EnableLoggin)
{
  // LogEntry is defined in the Entreprise Logging Library DLL
  // and use this class will cause the assembly to be loaded
  var entry = new LogEntry();
}

Into this one:

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
if(Properties.Settings.Default.EnableLoggin)
{
  // the previous code has been moved to a dedicated method
  this.LogMessage();
}
 
[MethodImpl(MethodImplOptions.NoInlining]
private void LogMessage()
{
  // code that uses LogEntry and needs to load the Loggin assembly
}

We can prevent the DLL from being loaded when the loggin option is not enabled ! Notice the MethodImpl attribute that prevents the compiler from inlining the method (which would take us back to the original code…)

4. Warm start

During warm start we’re not expecting to see as much I/O as during cold start. The first tool that should be used to analyze warm start is a CPU profiler.

In the FishBowl app, the main ListBox does not have virtualization turned on because each item has a variable height which cause a hang in the startup process. In order to improve the experience of the user, the app has been updated to load the elements in a background thread.

The real performance is not changed here, but the perceived performance for the user is much better because he has a visual feedback instantly !

5. RunTime

Using WPFPerf, it’s possible to find out what the CPU usage is (between animation, layout, rendering…). The perforator tool gives various graphs such as Frame Rate, Software and Hardware IRTs (Intermediate Render Target).

Currently if a Rectangle has DrapShadowEffect with an Opacity of 0, it is still computed by the rendering thread (it could be an optimization that WPF does internally but it’s not yet the case) which can cause performance issue when the parent item is animated.

A possible optimization is to split the Rectangle into 2 Rectangles:

  • the first one with the effect and an opacity of 0 (on the Rectangle itself not on the effect like previously)
  • the second one without any effect and an opacity of 1 (visible), a storyboard is set on this rectangle to make the first element visible by animating its opacity

In this case, because the first Rectangle is hidden (Opacity = 0), the cost needed to animate this rectangle is much better.

Aditionnal recommendations:

  • don’t block on the UI thread
  • use virtualization, if you can’t use it, improve the perceived performance by loading the items in a background thread
  • data virtualization
  • freeze your freezable !

6. Summary

  • Memory: images size, memory leaks, elements count
  • Cold start: disk I/O, module loads, NGen
  • Warm start: avoid blocking, delay work, perceived perf
  • RunTime: beware of IRTs, eventing

7. Tools

  • Process Explorer in order to know how much memory has been allocated
  • VMMap where the memory is going ? (native head, managed heap…)
  • .NET memory profiler the profiler that is being used by the WPF team internally at Microsoft
  • ETW: event tracing
  • WPFPerf: WPF performance analyzer

PDC09: some WPF sessions are available !

Events, WPF No Comments »

PDC09

Earlier today, I mentioned that PDC09 videos will be available soon.

The first WPF videos are now available ! This article will be updated once new videos become available:

  • How Microsoft Visual Studio 2010 Was Built with Windows Presentation Foundation 4 [VIDEO HERE]
  • Advanced Windows Presentation Foundation Application Performance Tuning and Analysis [VIDEO HERE]
  • Mastering WPF Graphics and Beyond [VIDEO HERE]
  • Windows Presentation Foundation 4 Plumbing and Internals [VIDEO HERE]
  • XAML Futures in Microsoft .NET Framework, Microsoft Silverlight and Tools [VIDEO HERE]
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in