Launch something before profiling starts

mihiesmihies Posts: 71 Bronze 4
Is there an option to launch a .bat or some other kind of executable before profiling starts?
For example, I would like to delete a couple of files each time profiling starts.
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
Blog:http://blog.rthand.com
Righthand .net consulting and software development
http://www.rthand.com

Comments

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

    There is no way to automatically start a process before profiling directly from ANTS Profiler. I think the best option may be to add some code to the beginning of your application to clear out these files.

    It should be possible to detect whether the code is being profiled by using .NET code to check the COR_ENABLE_PROFILING environment variable, for instance:
    if (System.Environment.GetEnvironmentVariable("COR_ENABLE_PROFILING") !=null)
                {
                    System.IO.File.Delete("c:\\temp\\something.ini");
                }
    
    Hopefully this is somewhat helpful!
  • mihiesmihies Posts: 71 Bronze 4
    Hi Brian,

    Sounds like a feasible workaround. However I hope you'll include such feature in a future release...
    Miha Markic [MVP C#, INETA Country Leader for Slovenia]
    Blog:http://blog.rthand.com
    Righthand .net consulting and software development
    http://www.rthand.com
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    I've raised it as a suggestion to our development team.

    Thanks!
Sign In or Register to comment.