How can we help you today? How can we help you today?

Error when starting Silverlight profiling session

Hello,

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 ?
XavierFischer
0

Comments

1 comment

  • Jessica R
    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

    <assemblyName>Name.Of.Offending.Assemby.dll</assemblyName>

    I hope this helps!
    Jessica R
    0

Add comment

Please sign in to leave a comment.