Build/Test Issues

Using NCrunch console on network drive results in ERROR (Internal).

Started by GreenMoose on 4,214 views

So, since we don't have NCrunch Console on Nuget yet I tried using NCrunch from a network location (using \\UNC\sharedPath and f:\MappedPath resulted in same error) I got below results:

[14:45:17.344-Core-8] Loading module: f:\Modules\MSTest\nCrunch.Module.MSTest.crunchmodule
[14:45:17.3752-Core-8] ERROR (Internal): An exception thrown while processing the module 'f:\Modules\MSTest\nCrunch.Module.MSTest.crunchmodule': System.IO.FileLoadException: Could not load file or assembly 'fil
e:///f:\Modules\MSTest\nCrunch.Module.MSTest.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///f:\Modules\MSTest\nCrunch.Module.MSTest.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be san
dboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly,
please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOn
FileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean thro
wOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurity
Checks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at nCrunch.Core.ModuleManagement.ModuleLoader.LoadModules(IList`1 additionalSearchPaths)



(Robocopying same directory into a subdir on local computer as a pre-build step resolved it)
This is caused by a constraint imposed by the .NET Framework. Basically, .NET doesn't allow the dynamic loading of assemblies from network locations without special configuration. It's possible that adding the loadFromRemoteSources switch would resolve this immediate problem, but NCrunch employs dynamic loading at so many levels in its architecture and across so many processes that I think you're bound to hit further downstream problems when attempting to do this. At the moment this isn't a supported use case. I recommend copying the files over before running the tool. If necessary, you could just use a script to copy them over for each execution run. The console tool isn't large (<20MB).

Post a reply

Log in to reply.