Page 1 of 1

ClickOnce and .NET Memory Profiler

Posted: Thu Sep 26, 2013 4:12 pm
by ngm
Hello there,

I'm evaluating .NET Memory Profiler and I was wondering what are my options to profile ClickOnce application running in production. It's .NET 2.0 application.

Can I use NmpCore.exe, if so what would be the correct substitution for a path?

Thanks,

- ngm

Re: ClickOnce and .NET Memory Profiler

Posted: Sun Sep 29, 2013 9:36 pm
by Andreas Suurkuusk
There is no option for launching a ClickOnce application from the profiler. However, it is still possible to profile a ClickOnce application by profiling the "AppLaunch" program using the "Profile Application" command. To profile your ClickOnce application using AppLaunch you will need to specify which application to launch by providing the correct command line arguments. You can retrieve the command line argument by launching the ClickOnce application and then use the Task manager to extract the command line. For example, you can perform the following to start profiling your application.
  1. Start your ClickOnce application outside of the profiler (e.g. by clicking a link on your website)
  2. Start the Task manager, and include the "Command line" column (right click on the columns and choose "Select columns").
  3. Locate the AppLaunch process and select it in the process list (hopefully there will be only one)
  4. Copy the AppLaunch info and paste it into an empty text document.
  5. Now you will see the path to the AppLaunch process and the necessary command line arguments.
Below you will see an example command line that will launch a ClickOnce application named "ClickOnce"

Code: Select all

NmpCore /p C:\Windows\Microsoft.NET\Framework\v2.0.50727\AppLaunch.exe /activate "http://clickoncesite.com/ClickOnce.application#ClickOnce.application, Version=2.0.0.5, Culture=neutral, PublicKeyToken=8ee76d1b2ac326f8, processorArchitecture=msil/ClickOnce.exe, Version=2.0.0.5, Culture=neutral, PublicKeyToken=8ee76d1b2ac326f8, processorArchitecture=msil, type=win32"

Re: ClickOnce and .NET Memory Profiler

Posted: Mon Sep 30, 2013 12:02 am
by ngm
Hello Andreas,

No luck here.

Our ClickOnce application starts with original *.exe process instead of AppLaunch.exe, that's probably because it works under full-trust.

Although I extracted full application name from the *.appref-ms I was unable to start it via AppLaunch.exe:

AppLaunch.exe /activate "http://server/Deploy/MyApplication.appl ... pplication, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx, processorArchitecture=x86"

I get "Error: An unexpected error occured -- The parameter is incorrect."

I tried adding version and type in the full application name string above like you've got in yours, but that didn't help either.

Also I tried altogether with NmpCore.exe but it resulted with the same error from AppLaunch.exe.

Please advise.

Thanks,

- ngm

Re: ClickOnce and .NET Memory Profiler

Posted: Mon Sep 30, 2013 7:32 pm
by Andreas Suurkuusk
If you are running the application under full trust, then the AppLaunch program is not used. Still you should be able to use the Task manager to get the path to the ClickOnce executable and then run the executable directly. I was able to run my test application using the command line:

Code: Select all

NmpCore.exe /r /p "C:\Users\Andreas\AppData\Local\Apps\2.0\LPCGQJE1.QK1\ZZ5A43J8.KQ1\clic..tion_8ee76d1b2ac326f8_0002.0000_df0839630f7d138f\ClickOnce.exe"
Note that I forgot to include the "/r" argument in my last post. The /r argument is needed when profiling a pre-.NET 4.0 process.

Re: ClickOnce and .NET Memory Profiler

Posted: Mon Sep 30, 2013 8:29 pm
by ngm
Andreas,

That's what I did at the very beginning, then the application didn't load completely because it uses user.config settings it was unable to find when starting directly like this.

Anyway, I know my options now. Will try some workaround.

Thank you for assistance.

- ngm