Here I will post problems I and my colleagues met and solutions we found.

Friday, November 26, 2010

Performance in WPF

Recently we struggled with the performance of our WPF application. Everything was slow. Changing size of the window - slow, maximizing - slow, refreshing - slow. Then I looked at CPU - it was using CPU in idle. Something definitely wasn't right.

And then I found WPF Performance Tool

Using this tool I found that we had animation running in the background. We used it to indicate that something is going on when we do asynchronous calls, and then we hided animated elements with visibility. Well, even being invisible, animation continued to use resources, and very noticeably


My conclusions are:
1. Be very careful with animation. Especially if you run without expiration time, but wish to stop them manually, don't forget to stop them.
2. There are performance tools that can help. Particularly, I paid attention to the "frame rate", which helped me to identify my problem. The values should be close to zero when application is idle. If you are serious, learn these tools.

Monday, November 15, 2010

app.config file and MSI

There are so many examples in the internet demonstrating how to update your app.config file during installation. But these examples never tell you about consequences of this action. And there are some.

If you use installer from Visual Studio 2008 or 2010, you probably use RemovePreviousVersion property, by setting it to true. However, starting from 2008, the the implementation of this feature changed significantly, so significantly that it has nothing to do with the name of the property. Previous version is no longer uninstalled, and there some rules for updating old files with new ones. While "versioned" files handled straightforwardly, by replacing the file with newer version, content files are replaced only if they were not changed after previous installation.

Back to updating app.config files during installation. When you changing them during installation, you change them from those that were included in your .msi package. That means it will be ignored in the next update.

See this link. http://msdn.microsoft.com/en-us/library/aa370531.aspx