What are the challenges you face when working across database platforms? Take the survey

Profiling application with async methods causes crash

printplusprintplus Posts: 3
edited February 5, 2015 4:31PM in ANTS Performance Profiler 9
I have following simple .NET 4.5 application to test async handling with Performance Profiler 9:
class Program {

    static void Main(string[] args) {
      Worker w = new Worker();


      Console.WriteLine("Program End.");

  class Worker {

    public async void DoSomethingAsync() {
      Task task = Task.Factory.StartNew(this.DoSomething);
      await task;

    public void DoSomething() {
      int max = 1000000000;      
      TimeSpan ts = TimeSpan.Zero;

      Console.WriteLine("Start worker...");

      for (int i = 0; i < max; i++) {
        ts = new TimeSpan(0,5,0);        

      Console.WriteLine("Worker ende...");

If I start a profiler session the profiler crashes immediatly. If I call the syncron method DoSomething() everything works well.
If've tried different settings (with Async awareness true/false, enable Inlining true/false) with no success. What is the problem?
Is there an ANTS Perfomance Profiler 9 bug, or something else?



  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi Atilla,

    Thanks for your post! We have a support ticket open for you (#36217) for this issue.

    I was actually unable to reproduce the crash locally but I noticed from your screenshot that there's a call to AsyncCausalityTracer just before the crash, but I don't see any call to that from my profiling results. I don't know much about this module, but is there something added to your copy of the test solution, or just something on your machine that is making your application call on it?

    I've asked on the ticket if you are able to do a quick test on another machine to see if your applications still crash for you there--please let me know!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

  • Options
    Hi Jessica,

    I started testing again 'cause my little testproject can now be profiled with the ANTS Prefomance Profiler.
    So I was looking for differents and searching for the reason. Then I stumble over the build setting, which
    seems to cause all my profiling problems: Prefer 32-bit

    If this checkbox is checked, the profiling process crashes on my machine (and on two others).
    If its unchecked, everything works well.

    So my question now:

    Is ANTS Performance Profiler 9 not able to profile 32-bit applications with async?
    We cant use this checkbox checked, because we don't have a 64-bit application (the third party assemblies are also 32-bit).

    We use Windows 8.1 pro 64-bit and VS2012.
  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi Atilla,

    Thanks very much for the update!

    The profiler should work fine with applications that use async and run as 32-bit. (There was a known issue with version 8.4 and profiling a 32-bit processes with the "async awareness" option enabled, though this would give a specific error and has been resolved since version 8.5) . I've also tried the test application with "prefer 32-bit" checked on a 64-bit Win 8.1 machine with no issues.

    If that option is enabled so that your process runs as 32-bit though, that gives the application a smaller memory max than if it were running as 64-bit. The crashing could be due to the process running out of memory. Can I please check--what is the memory usage of your application just before the crash? (A 32-bit process will usually start acting up once it nears 1.5 GB). Does it help to use "Sampling" mode of profiling?

    Can I also please clarify--is the error you're getting in your real application the same as what the test application was throwing (a System.AccessViolationException after a call to Windows.Foundation.Diagnostics.. )? Can you please reproduce the crash with your real application and then check Event Viewer for any related errors regarding the profiler or your application?

    Thank you!

    Jessica Ramos

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

Sign In or Register to comment.