How do you Profile a VSPackage

I have a VSPackage which loads a Tool Window into Visual Studio. You debug this by running a second instance of VS from the first instance. Because the VSPackage executes from within VS itself, how can I profile it with ANTS?
KCS

Comments

  • Hi,

    You should be able to profile a VSPackage by profiling devenv.exe. Just choose to profile a desktop application and point it at devenv.exe - you will need to add the right command line arguments to devenv.exe to get it to use your experimental registry hive rather than the main registry hive so that it loads your VSPackage.

    James
    James Moore
    Head of DBA Tools
    Red Gate Software Ltd
  • Thank you. This does indeed start to profile (VS2005) as you suggest.

    However at present I get (whilst profiling starts) an 'attempt to access protected memory' exception, which does not occur when running the application directly in run or debug mode in VS. I will investigate to try to see what code causes this whilst profiling.

    I have also noticed that accessing a decode stream (to decrypt a string value) in a particular code location causes profiling to fail, where this also works without exception in VS. I had to skip this code to sucessfully profile (in this case) a standalone EXE.
    KCS
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi,

    I think we may need to send an update to RedGate.Profiler.Core2.dll to you. Can you please let us know which version of Profiler this is happening on? If you're not on 3.2, an upgrade may help. If not, I have a fix that I hand out to a few customers to solve the problem that I can email you.
  • Hello
    My version is 3.2.0.27 which I downloaded a few days ago.
    Thanks
    KCS
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Kevin,

    I have emailed the patch to the email address you had used to register your forums account.
  • Hello.

    The 'patch' sent DOES appear to have resolved the two issues I mentioned.

    I do have another query - my VSPackage also runs in 'standalone' mode (i.e. ouside Visual Studio). When profiling in this mode the speed of execution does not appear to be much different than when profiling.

    But when profiling DEVENV it appears that the process takes much, much longer (about 10-15 times longer) and ties up the processor at 100% during this time. Is this expected behaviour when profiling Devenv?

    Thanks
    KCS
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Kevin,

    I sure am glad that the patch fixed the major problem that was happening. ANTS Profiler will introduce an overhead, but it could be made worse in devenv if, for instance, managed debugging assistants are turned on or Visual Studio is catching a lot of handled exceptions.
Sign In or Register to comment.