Today I encountered a very strange error, not sure how I got myself into that situation, but I was getting this error when trying to do a Build on a SSRS report in VS: "Loading this assembly would produce a different grant set from other instances.".
I am not repeating content I find in other places very often, but this was is a keeper. So the easy fix in the community answers from the AX Support team: https://community.dynamics.com/ax/b/axsupport/archive/2015/05/19/crash-or-hang-during-ax-project-or-report-build-visual-studio-2013-ax-r3-cu8
Basically you have to create a new System Variable named COMPLUS_LoaderOptimization and set its value to 1.