Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

First click of button is slow

Tags:

c#

.net

wpf

I've created a simple application with wpf, and noticed a strange behavior: the Application has two buttons, with unrelated and very simple behaviors. Whenever I launch it, the first click of any of the buttons takes two to three seconds to complete. Only the first click is slow. Subsequent clicks are almost immediate, as expected for their simple behaviour. I've searched google and SO, but nobody seems to be experiencing the same problem.

the details of the application are:

NorthWind db on SQL server 2008;

Linq to SQL auto generated classes;

Customers Table as a DataGrid;

Button 1 OnClick Event: Context.SubmitChanges();

Button 2 Onclick Event alternates a boolean DependencyProperty on the MainWindow class.

As you can see, the setup is very simple. If every single click of the buttons was slow, I would have attributed them to WPF performance issues. What is strange is that whenever I launch it, only the first click responds slowly, and others are normal.

like image 507
jose Avatar asked Oct 03 '13 13:10

jose


1 Answers

Just to get this question off the unanswered list, here are my findings: this is a known issue with the gesture capture of IntelliTrace. Turning off the gesture capture (Tools>->Options->IntelliTrace->IntelliTrace Events) makes the problem go away completely. More details can be found in this answer

like image 113
jose Avatar answered Oct 19 '22 20:10

jose