When using P/Invoke, adding [SuppressUnmanagedCodeSecurity] can speed calls from managed code into unmanaged code in trusted scenarios.
Is there a way to accomplish the same thing in the reverse direction, to speed things up when I call from unmanaged code back into managed code? Profiling shows a much higher overhead going in that direction in our application.