Hi Charlie,
Thanks for the prompt reply. I think I have solved the problem.
From the stack trace (included below) it looks like the failure
originates from the following call :
NUnit.Core.DomainInitializer.CreateInstance(AppDomain
targetDomain)
So I downloaded and compiled the source with VS2008 and made changes
as per the blog entry I mentioned in my first message (http://
blogs.msdn.com/b/shawnfa/archive/2009/06/08/more-implicit-uses-of-cas-
policy-loadfromremotesources.aspx). This just involved modifying line
118 of DomainManager.cs as follows (have included the line beginning
log.Info to make it easy to find) :
log.Info("Creating AppDomain " + domainName);
PermissionSet trustedLoadFromRemoteSourceGrantSet = new
PermissionSet( System.Security.Permissions.PermissionState.Unrestricted );
AppDomain runnerDomain =
AppDomain.CreateDomain(domainName, evidence, setup,
trustedLoadFromRemoteSourceGrantSet, null);
Could this change be incorporated into the source for future NUnit
releases ?
I tried to run all the tests to make sure that the change didn't break
anything by running the "NUnitTests.nunit" project (in the vs2008
folder) and found that 2800 tests passed but there were 12 errors.
However, these errors appear to be present in the original
distribution of the source (NUnit-2.5.7.10213-src.zip) i.e. without
any source modifications these 12 errors occur. Also I was unable to
build under the Release configuration in Visual Studio (got a number
of compilation errors). Once I added the conditional compilation
symbol NUNIT_2_5 to the Release configuration of the projects : pnunit-
agent, pnunit-launcher and pnunit.framework it compiled fine.
If you can make this modification and run all the unit tests that
would be great.
Thanks again,
Joel.
Server stack trace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,
String codeBase, Evidence assemblySecurity, RuntimeAssembly
locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound,
Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName,
String codeBase, Evidence assemblySecurity, RuntimeAssembly
locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound,
Boolean forIntrospection, Boolean suppressSecurityChecks)
at
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark,
Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String
assemblyFile, Evidence securityEvidence, Byte[] hashValue,
AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean
suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile,
Evidence securityEvidence)
at System.Activator.CreateInstanceFromInternal(String assemblyFile,
String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder
binder, Object[] args, CultureInfo culture, Object[]
activationAttributes, Evidence securityInfo)
at System.Activator.CreateInstanceFrom(String assemblyFile, String
typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder,
Object[] args, CultureInfo culture, Object[] activationAttributes,
Evidence securityInfo)
at System.AppDomain.CreateInstanceFrom(String assemblyFile, String
typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder,
Object[] args, CultureInfo culture, Object[] activationAttributes,
Evidence securityAttributes)
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String
assemblyName, String typeName, Boolean ignoreCase, BindingFlags
bindingAttr, Binder binder, Object[] args, CultureInfo culture,
Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String
assemblyName, String typeName, Boolean ignoreCase, BindingFlags
bindingAttr, Binder binder, Object[] args, CultureInfo culture,
Object[] activationAttributes, Evidence securityAttributes)
at System.Activator.CreateInstanceFrom(AppDomain domain, String
assemblyFile, String typeName, Boolean ignoreCase, BindingFlags
bindingAttr, Binder binder, Object[] args, CultureInfo culture,
Object[] activationAttributes, Evidence securityAttributes)
at NUnit.Core.DomainInitializer.CreateInstance(AppDomain
targetDomain)
at NUnit.Util.DomainManager.CreateDomain(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Util.RemoteTestAgent.AgentRunner.Load(TestPackage package)
at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, 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 NUnit.Core.TestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Util.ProcessRunner.Load(TestPackage package)
at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
at NUnit.ConsoleRunner.Runner.Main(String[] args)
> > loadFromRemoteSources switch. Seehttp://
go.microsoft.com/fwlink/?LinkId=155569
> > for more information.
>
> > For some reason the assembly 'nunit.core.DLL' will not load from the
> > networked drive?
>
> > With .Net 2 we needed to use caspol.exe to enable full trust on our
> > networked (J:) drive in order to use assemblies on this drive.
>
> > After reading the link in the error message and also this article :
>
> >
http://blogs.msdn.com/b/shawnfa/archive/2009/06/08/more-implicit-uses...
>
> > I tried enabling the loadFromRemoteSources switch but this did not
> > work (see Note 1 below).
>
> > Notes :
> > 1. I have modified the nunit-console.exe.config is as follows :
> > <configuration>
> > <startup>
> > <requiredruntime version="v4.0.30319"> </requiredruntime>
> > </startup>
> > <runtime>
> > <loadFromRemoteSources enabled="true" />
> > </runtime>
> > </configuration>
>
> > 2. If the nunit-console.exe is on a local drive then it runs fine.
>
> > 3. If the unit test assemblies are built targetting .Net 2 then the
> > tests run fine.
>
> > Any ideas would be much appreciated.
>
> > Thanks in advance,
> > Joel Gordon.
>
> > --
> > You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
> > To post to this group, send email to
nunit-...@googlegroups.com.
> > To unsubscribe from this group, send email to
nunit-discus...@googlegroups.com.
> > For more options, visit this group athttp://
groups.google.com/group/nunit-discuss?hl=en.- Hide quoted text -
>
> - Show quoted text -