Major issue with Performance Profiler
paulinuk
Posts: 1 New member
Hello
We have a massive issue with the profiler
Does anyone know how to resolve the error below?
System.MethodAccessException: Attempt by security transparent method 'System.Net.Http.HttpClient.FinishSendAsyncBuffered(System.Threading.Tasks.Task`1<System.Net.Http.HttpResponseMessage>, System.Net.Http.HttpRequestMessage, System.Threading.CancellationTokenSource, Boolean)' to call native code through method '<Module>._ANTS_Begin_Async()' failed. Methods must be security critical or security safe-critical to call native code.
We have a massive issue with the profiler
Does anyone know how to resolve the error below?
System.MethodAccessException: Attempt by security transparent method 'System.Net.Http.HttpClient.FinishSendAsyncBuffered(System.Threading.Tasks.Task`1<System.Net.Http.HttpResponseMessage>, System.Net.Http.HttpRequestMessage, System.Threading.CancellationTokenSource, Boolean)' to call native code through method '<Module>._ANTS_Begin_Async()' failed. Methods must be security critical or security safe-critical to call native code.
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.GetAsync(Uri requestUri, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.GetAsync(String requestUri)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Inspired.TradingPlatform.PositionManagement.Tests.Console.Scenario.Scenario.<RunAsync>d__2.MoveNext() in --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
Paul
Tagged:
Answers
If the offending DLL is your own code, you can try just removing the [AllowPartiallyTrustedCallers] attribute (if present)
You can disable async profiling (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 Gate\ANTS Performance Profiler 10