I ran into this question looking for an answer to a very similar problem during the upgrade from the TFS2010 build server to TFS2012.
Our projects already focused on .NET 4.0 and unit tests worked before the update.
Since .Net 4.5 is an in-place upgrade, the 4.0.Net 4.5 bug introduced by Microsoft may cause this problem in targeted .Net 4.0 projects. This is probably due to the SecurityRules answer, but internal to dll systems (e.g. Microsoft.VisualStudio.QualityTools.UnitTestFramework).
For the fix related below, the following was fixed: "The operation may destabilize the execution time." exceptions to what was otherwise working unit tests.
http://support.microsoft.com/kb/2748645
Hope this saves someone else time
source share