chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hi,

We're in the middle of upgrading the TypeMock Isolator from version 5.1.1 to version 5.4.4 and now we get the following error on a lot of our unit tests:

Error Message
Class Initialization method SimCorp.IMS.Compliance.Engine.Test.CustomFormulaTest.ClassInitialize threw exception. System.Reflection.TargetInvocationException: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed..

Error Stack Trace
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
System.Security.CodeAccessPermission.Demand()
System.Environment.GetEnvironmentVariable(String variable)
TypeMock.AutoFake.TyphoonConfiguration.IsInAutoFake()
TypeMock.MockManager.b()
TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4)
TypeMock.InternalMockManager.isMocked(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected)
SimCorp.IMS.Framework.Formulas.FormulaExecutor..ctor() in c:TempIMS Team ProjectMain_Development_Full_QCSourcesSimCorpIMSFrameworkFormulasFormulaExecutor.cs: line 21
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
System.Activator.CreateInstance(Type type, Boolean nonPublic)
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
System.Activator.CreateInstance(String assemblyName, String typeName)
System.AppDomain.CreateInstance(String assemblyName, String typeName)
System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
SimCorp.IMS.Framework.Formulas.Engine.FormulaCalculator.CreateFormulaExecutor(AppDomain appdomain) in c:TempIMS Team ProjectMain_DevelopmentSourcesSimCorpIMSFrameworkFormulasEngineFormulaCalculator.cs: line 189
SimCorp.IMS.Framework.Formulas.Engine.FormulaCalculator..ctor(Result`2 assemblyresolver) in c:TempIMS Team ProjectMain_DevelopmentSourcesSimCorpIMSFrameworkFormulasEngineFormulaCalculator.cs: line 34
SimCorp.IMS.Compliance.Engine.FormulaDictionary..ctor() in c:TempIMS Team ProjectMain_DevelopmentSourcesSimCorpIMSComplianceEngineFormulaInformation.cs: line 42
SimCorp.IMS.Compliance.Engine.Test.CustomFormulaTest.ClassInitialize(TestContext testContext) in C:workspacesCompTypeMockTestMainDevelopmentSimCorpIMSComplianceEngineFormulasTestCustomFormulaTest.cs: line 24

Is this an known error? Is there something we can do to workaround this?
asked by MNuppenau (600 points)

1 Answer

0 votes
Hi,

This is a bug we encountered recently. It happens when creating AppDomains with limited permissions. I suspect this is the case you are experiencing. Luckily, this bug is already fixed and it's part of Isolator release from yesterday. You're can download it here:
http://site.typemock.com/download/

Please let me know if it works.

Regards,
Elisha,
Typemock Support
answered by Elisha (12k points)
...