2

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.Stopwatches 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.

Michael K.
  • 423
  • 1
  • 4
  • 13
  • 1
    This could be helpful: [https://stackoverflow.com/a/12003677/3455216](https://stackoverflow.com/a/12003677/3455216) – Claudio P Sep 16 '19 at 13:33
  • Try to run the executable in your build folder (Debug or Release) directly and not via Visual Studio. – Claudio P Sep 16 '19 at 13:35
  • Possible duplicate of [Application runs faster with visual studio performance analysis](https://stackoverflow.com/questions/11984411/application-runs-faster-with-visual-studio-performance-analysis) – Claudio P Sep 16 '19 at 13:37
  • You should provide a minimal piece of code people can use to reproduce your issue. Without that, you're reliant on someone guessing who's seen your issue themselves. Vs hosting elevates privileges seems unlikely this would be your issue but there's an option to disable on the projects debug tab. Debugging usually also alters focus of course. – Andy Sep 16 '19 at 13:37
  • @Andy A guess that turned out well. And the issue itself does not lend it self to small examples. This more a "what is different in those two cases?" question. For those examples do not really help, only "seen it before" does. – Christopher Sep 16 '19 at 13:40
  • @Andy No. This is a huge multi-component piece of software and I have no clue in what component this issues arises from. This is the main part of the problem: I'm out of ideas where to look and what to try. If I could give a minimal example I wouldn't have a question. – Michael K. Sep 16 '19 at 14:06

0 Answers0