Scope:
This seems to happen only on .NET framework 4.8 projects (YMMV)
Problem:
A combination of assembly loading results in different grant sets
Workaround:
Create a new DWORD registry value called LoaderOptimization as below:
KEY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
DWORD LoaderOptimization
VALUE 1
[ see also 1 ] [ see also 2 ]