Error when starting Silverlight profiling session

XavierFischerXavierFischer Posts: 2
edited October 22, 2014 11:56AM in ANTS Performance Profiler 8

When I start profiling my Silverlight App (which works fine when not profiled), I have a strange error message :
(in french, but translated by me)
System.MethodAccessException: Attempt by security transparent method '[MySlMethod]' to call native code through method '<Module>._ANTS_Begin_Async()'. Methods must be security critical or security safe-critical to call native code.

It seems that ANTS profiler injects code that is causing the exception.

What could I do ?


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

    Thanks for your post!

    The error you're seeing happens when the profiler tries to do async profiling (using native methods) on a method that is marked with the [AllowPartiallyTrustedCallers] attribute (making it not security critical). This causes the System.MethodAccessException, but there are a few options to get around this:

    - If the offending DLL is your own code, you can try just removing the [AllowPartiallyTrustedCallers] attribute

    - You can disable async profiling completely (Tools>Advanced Options> Profile with Async awareness)

    - Or you can keep the async profiling option turned on and also avoid the error if you add the offending dll to the profiler's line-level blacklist. You can do this by adding the following line to the LineLevelBlacklist.xml file in %localappdata%Red GateANTS Performance Profiler 8


    I hope this helps!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

Sign In or Register to comment.