I have a Wpf application. It does calls with a rpc-framework to send commands to another application and recieves events from this framework to update some datagrid. it does not contain a lot of data, about 20 rows with, each with a viewModel with out 20 Properties, about 10 of them primitive types, the other are quite simple objects.
Using this application is painfully slow. Clicking buttons takes 1-2 seconds, in that time the gui freezes. I would like to know where this time is spend, but so I tried adding System.Diagnostics.Stopwatch
es in all functions i could find and log the results. All relevant functions take 10ms or less, and none of them are called too often and nothing explains a multisecond delay.
I tried warpping the Manuplation of tte the observalecollection of the datagrid inside a
using(var d = Dispatcher.DisableProcessing())
{
// work with the collection
}
block.
The application on the other side recieves and responds to the RPC calls on the other side almost instantly.
I have no idea why everything takes so long.
So I tried profiling it with visual studio. I tried CPU usage, Instrumentation (I think I want this) and Application timeline.
And here is the problem: My stopwatches do not give me any meaningful information, but when i run the application in the profiler, it runs smoothly. (In both release and debug build). Attaching a debugger does not make it any faster either, in either configurations.
What can I do next? I obviously can tell the custumer to run the application inside a profiler.