I am using VS 2012 with NCrunch. I'm running NUNit tests using Resharper, VS and NCrunch. The problem I have is in an older log4net library that throws System.TypeInitializationException when creating a logger.
This has made it so that the application runs without the error, and the unit tests pass in Resharper test runner as well as MS Test runner. I still have this error in NCrunch, however.
I tried making the following modification to files:
Depending upon its configuration, NCrunch will usually run your tests inside a hosted environment that doesn't consider the .config files. However, you can easily change this.
Under your global NCrunch configuration, you'll find an option called 'Use hosted task runner'. Set this to FALSE, and your modifications to the nCrunch.TaskRunner*.config files should start working.
Make sure you reset the engine after applying this setting. If it takes effect, you should see the NCrunch task runners as showing up under the names 'nCrunch.TaskRunner40.x86.exe', etc.
I'll message you with an email address if you'd like to send a sample project. NCrunch has seen limited testing around CAS and there are a number of known issues at the moment, so it would probably be good to solve this one at the same time!
I was not able to reproduce the exception in a standalone example and the full solution is too large to send anyway. I did, however, find a way to make our library work correctly by adding the following to AssemblyInfo.cs:
[assembly: SecurityRules(SecurityRuleSet.Level1)]
Not an ideal solution, but it'll work for us for now.