KB: Attempt by security transparent method X to access security critical method Y failed
This runtime error will occur when a function is called that has code utilising another function or class that has not specified it's security level.
To resolve this, you can add "[SecuritySafeCritical]" above the calling function, like this:
using System.Security;
[SecuritySafeCritical]
void the_callee()
{
the_problematic_function();
}
void the_problematic_function()
{
...
}