SecurityException when loading dll into NUnit

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
Tim Wiffen

SecurityException when loading dll into NUnit

Post by Tim Wiffen » Thu Oct 27, 2005 12:44 pm

I am trying to profile a dll of test cases using NUnit 2.2.0 (http://www.nunit.org). However if I launch nunit-gui.exe with the profiler it is incapable of loading any test dll without causing the security exception shown below. I have copied the exception from the "Exception Details" window in nunit-gui.exe.

I wanted to check it wasn't just my application so I tried loading the test cases that come as part of NHibernate (http://www.nhibernate.org) and got exactly the same error.

.NET Memory Profiler gives the error:
"A module has been unloaded (due to an application domain being stopped). Because of an error in the .NET Framework no static fields will be identified for newly loaded classes."

Any suggestions?

---------------

System.Security.SecurityException: Request failed
Server stack trace:
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at NUnit.Util.TestDomain.MakeRemoteTestRunner(AppDomain runnerDomain)
at NUnit.Util.TestDomain.get_Runner()
at NUnit.Util.TestDomain.Load(String testFileName, String appBase, String configFile, String binPath, String[] assemblies, String testFixture)
at NUnit.Util.TestDomain.Load(NUnitProject project, String testFixture)
at NUnit.Util.TestLoader.LoadTest(String testName)

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Thu Oct 27, 2005 4:38 pm

There is a problem when using NUnit and other unit testing frameworks together with root referee identification and the heap utilization tracker. This problem occurs when an application supplies the evidence of the running domain when creating a new application domain, which NUnit does.

The solution to this problem is to disable root referee identification and heap utilization tracking (under the Interactive page in the Settings dialog). The problem does not exist under .NET Framework 2.0, so another solution is (if possible) to run the application under .NET Framework 2.0.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests