Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# WPF Very slow application launch

I've wrote a simple .net WPF application(contains only 2 small windows), but its launch is too slow - about 10-20 seconds!

Profiler says:

  • Main->RunInternal(56%)
  • Main->RunInternal->ctor->LoadBaml(32%)

Biggest part of application load time - is body of Main->RunInternal function, this isn't my function and i don't know what they makes. Can their execution time somehow be optimized?

Loading Baml markup it takes 32% of all time, but my program have only 3 XAML files and they are containing less than 100 lines of code. Why does this action take so long?

Before asking I have read and tried these tricks, but they didn't help me:

  • WPF application slow on startup
  • http://msdn.microsoft.com/en-us/library/cc656914.aspx

So, how can I speed up the start time of my application?

Thanks.

PS. I've tested this program on two similar computers and the result is a same.

like image 998
Roman Nazarkin Avatar asked Apr 30 '13 07:04

Roman Nazarkin


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is C in C language?

What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.

Is C language easy?

Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.

Why is C named so?

Because a and b and c , so it's name is C. C came out of Ken Thompson's Unix project at AT&T. He originally wrote Unix in assembly language. He wrote a language in assembly called B that ran on Unix, and was a subset of an existing language called BCPL.


2 Answers

Look at the article mentioned in the comments above.

I would suppose it is 8, (Authenticode), it depends on what assemblies you are referencing

like image 103
Boklucius Avatar answered Sep 19 '22 02:09

Boklucius


I have the same problem. Google with RunInternal gives me nothing.

I then tried to backup my previous codes and delete assemblies and files until there was only a window left.

Then it worked -- the startup time was shortened from 10 sec to 1 sec!

This time, the profiler showed only System.Windows.Application.Run() instead of RunInternal

It's very strange that for this computer, even after re-importing the bugged(slow) version, it worked correctly! whereas my laptop, which did not go through the fixing above still boots the program for 10+ sec.

like image 1
user2127480 Avatar answered Sep 22 '22 02:09

user2127480