| 64 | === System.Security.!SecurityException === |
| 65 | |
| 66 | When you run a program created with Cobra you get "Unhandled Exception: System.Security.!SecurityException". |
| 67 | |
| 68 | This happens on Windows when the current directory is a network drive and the Cobra test runner is invoked. The key call within the test runner is to the instance method System.Reflection.Assembly.!GetName(). The exception reads: |
| 69 | {{{ |
| 70 | Unhandled Exception: System.Security.SecurityException: Request for the permissi |
| 71 | on of type 'System.Security.Permissions.FileIOPermission, mscorlib, |
| 72 | Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. |
| 73 | at System.Security.CodeAccessSecurityEngine.Check(Object demand, |
| 74 | StackCrawlMark& stackMark, Boolean isPermSet) |
| 75 | at System.Security.CodeAccessPermission.Demand() |
| 76 | at System.Reflection.Assembly.VerifyCodeBaseDiscovery(String codeBase) |
| 77 | at System.Reflection.Assembly.GetName(Boolean copiedName) |
| 78 | at System.Reflection.Assembly.GetName() |
| 79 | at Cobra.Lang_ert_5ff8.Test.TestRunner._collectTestsFor(Assembly ass, |
| 80 | Boolean willFollowReferences, Set`1 found) |
| 81 | ... |
| 82 | }}} |
| 83 | |
| 84 | Workarounds include: |
| 85 | 1. Run the program on a non-network drive. |
| 86 | 2. Recompile with -include-tests:no option. |
| 87 | |