WPF Window Extremely Slow to Open

So I am using WPF windows as dialogs for a plugin I am working on. However, when the user opens a WPF window for the first time, it is extremely slow. The initial load takes 25 seconds or more. Then every time it opens after that, it opens instantly. What could be causing this? How can I fix it? The window I am trying right now is just an empty WPF window with 1 label. It seems like this should load instantly.


Hi Ryan,

We’re going to need to see a sample project, that replicates the problem, so we can build it and run it here.

– Dale


I have a super simple project for you right here. The command tries to open a WPF window in Rhino. However on my machine the first time the command it run it takes 25-30 seconds for the window to appear, then every other time it is nearly instantaneous.

WPF_Form_Demo.zip (35.8 KB)

Let me know if you have any questions.


This is probably related to the fact that WPF needs to load a lot of support DLLs before it can show stuff. I have noticed the delay as well, although in my case with an SSD it is only a couple of seconds at most, and have always attributed it to that.

Normal WPF applications typically show a splash screen during this period of loading support DLLs.

I’m not seeing a noticeable delay here (this isn’t to say you aren’t.). If you watch your output window (in Visual Studio), you will need a number of DLLs loaded when your command is run (which is probably the delay you are seeing).

25 seconds is way too long. Are you seeing this only when running in the Visual Studio debugger? If that is the case, you may be waiting for symbols downloading from Microsoft.

How can I make sure I am not running with Visual Studio Debugger?

If you are running Rhino from VS, you will have to press F5 or click the “Play” button to start the debugger.
To start Rhino from VS, but not with the debugger, press Ctrl+F5. Or just click the Rhino icon on your desktop or from your start menu like any normal user would do. Then you are certain not to run the debugger.

Even when I run it from Rhino started on its own, and with the plugin located on my C drive which is a SSD. it is still taking 20-25 seconds. I can make a video if that helps. Again, for some reason it is only the inital load. Every other time, it opens instantaneously.

Is there any way I can profile the code to see exactly what it is executing?

You can see what is going on by running it in the Debugger from Visual Studio (F5). Before starting it, open the “Output Window”. Each time a library is loaded, or a message is printed, it gets written to that window. You can see which libraries take a long time to load, or maybe other messages that may give some more information.

If you’re making a video, please make it from the debugger with the output window open.

Just to make sure: when you say initial load, it is the first time your plug-in is loaded, but it happens every time you start Rhino? Or is it only when you start Rhino for the first time, then when you start Rhin again, the load time is not so long?

Also you might try this solution

basically, it could be a problem with the NGEN images. To try to solve, open an administrative console and run

cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
ngen update

Try to use NGEN. Made a huge difference on my application. Read about it in my blog.