profiling a DLL

Hello,

I'm trying out the latest version of Ants profiler.

I want to profile the .Net code in a DLL that's loaded by mstest.

So, I profiled:

App: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\mstest.exe

Working Dir: D:\Daily\Vault\Main\FunctionalTests\VaultFunctionalTests\bin\Release

Argument: /testcontainer:VaultFunctionalTests.dll

However, the profile came up with NO .Net code profiled. Why not? The VaultFunctionaltest.dll is a .Net DLL that I was trying to profile.

How do I do this?

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Steve,

    It's not as easy as profiling mstest.exe because mstest actually starts a new process that hosts your dll. Since ANTS Profiler cannot cross process boundaries, you get no results. The proposed workaround is here. If this is not successful, please let me know. Well, let us know either way if you don't mind!
  • running vstesthost under the profiler simply starts then exits.

    how do you do this to get a profile of the test running?
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Steve,

    If you can actually get mstest.exe to work from the command-line, ANTS Profiler will show you results for the unit test if the /noisolation argument to mstest is used. Supposedly there is a drawback to using /noisolation in that the mstest process will become less stable. Here is the project setup that I had got to work in ANTS Profiler, after, of course fiddling around with MSTEST.exe for about an hour trying to figure out where to copy the assembly that I want to test! (Very important: run your mstest command in a console window first to ensure it actually works before throwing it at ANTS Profiler!)
    • .Net Desktop Application: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\MSTest.exe
    • Working directory:C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
    • Arguments:/testcontainer:"C:\Documents and Settings\me\My Documents\Visual Studio 2005\Projects\MyProject\TestProject1\obj\Debug\testproject1.dll" /runconfig:"C:\Documents and Settings\me\My Documents\Visual Studio 2005\Projects\MyProject\localtestrun.testrunconfig" /test:MyMethodTest /noisolation
    Hopefully you can also get this to work successfully.
  • Hello,

    I've tried to profile a Unit test using mstest and your proposed configuration, but have a serious problem with the /noisolation parameter:
    This parameter prevents the unit test from getting the unit tests configuration file. So I'm still unable to profile my unit test:

    - Without /noisolation option the Unit test succeeds, but cannot be profiled, because mstest starts the test in a new process (vstetsthost.exe) Ants cannot profile
    - with /noisolation option I could profile, because mstest performs the test in the same process context, but the result is worthless: My test failes because it cannot read the test's configuration file

    Any idea, how to get out of this predicament

    Regards,
    Burkhard
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Burkhard,

    I haven't tested it, but maybe MSTEST's /runconfig argument is what you need in your argument line for ANTS Profiler.
  • Hi Brian,

    I already have used the /runconfig option. It does not work.

    Regards,
    Burkhard
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Maybe someone at Microsoft would be better-qualified to answer this. Have you tried the MSDN forums?
  • I've tried the MSDN and found the /noisolation and the config file problem described. The solution there is NOT to use the /noisolation option. This makes my unit test pass but, I'm still unable to profile as I described earlier.

    My question is more like: "Is there any other trick to profile a Unit test with ANTS? Is it possible to attach the Vstesthost.exe process with ANTS?Will this problem be solved in a future release of ants?"

    Regards,
    Burkhard
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    If we can get ANTS Profiler to support profiling a process started by the process being profiled, then yes. I know that we are looking into supporting this at the moment, but I'd be hesitant to promise that we will see it in ANTS Profiler v4 when it's out. Otherwise I'm afraid there isn't a workaround I can suggest at this time.
Sign In or Register to comment.