WPF application slow on startup

Nelson Reis picture Nelson Reis · Jul 6, 2009 · Viewed 8k times · Source

My WPF application currently only shows a screen with some controls, it doesn't connect to DB or has any other functionality. It's a simple UI screen.

When I was testing in some computers (WinXP SP2), I've detected that it took more than 15 seconds to startup. They were all in our domain.

I've grabbed a similar computer, only with Windows installed, and the application took 2 seconds to startup.

Then I added the computer to our domain, and testing it with a domain user showed that it also took 15 seconds to startup. I tested again with the previous user (local user) and it's still fast. I created another local user, but it takes the 15 seconds that the domain user also takes. I've added other local users but they were also slow.

To summarize: the application starts fast (2 sec) in only one user, the first one I tested. All other users (domain or local) are slow (15 sec).

I've been checking Improving WPF applications startup time but my problem seems to need a different approach. Does anyone figure out what can be happening?

Answer

Nelson Reis picture Nelson Reis · Jul 6, 2009

I found another solution to this problem in this documentation from Microsoft.

Adding the following configuration to the app.config file will also solve the problem:

<configuration>
    <runtime>
        <generatePublisherEvidence enabled="false"/> 
    </runtime>
</configuration>

This way, you don't need to change computer configurations. It's just configuration of the application.

UPDATE:
Seems that .NET 4.0 fixed this issue, as documented here on MSDN.