fsprojects / ProjectScaffold

A prototypical .NET solution (file system layout and tooling), recommended for F# projects
http://fsprojects.github.io/ProjectScaffold
The Unlicense
515 stars 154 forks source link

NUnit-console crashes #241

Closed simendsjo closed 7 years ago

simendsjo commented 8 years ago

I tried ProjectScaffold on Windows running in VirtualBox, but it crashes when building. To reproduce:

  1. Clone
  2. Run ./build.cmd

I tried adding AllowPartiallyTrustedAttribute to both the Test assembly and the main assembly, but the output is the same.

Starting Target: RunTests (==> CopyBinaries)
E:\tmp\monogame-test\ProjectScaffold\packages\test\NUnit.Runners\tools\nunit-console.exe "-nologo" "-noshadow" "-labels" "E:\tmp\monogame-test\ProjectScaffold\tests\mogascii.Tests\bin\Release\mogascii.Tests.dll" "-xml:TestResults.xml"
E:\tmp\monogame-test\ProjectScaffold\packages\test\NUnit.Runners\tools\nunit-console.exe "-nologo" "-noshadow" "-labels" "E:\tmp\monogame-test\ProjectScaffold\tests\mogascii.Tests\bin\Release\mogascii.Tests.dll" "-xml:TestResults.xml"

Unhandled Exception: System.TypeInitializationException: The type initializer for 'NUnit.ConsoleRunner.Runner' threw an exception. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers.
   at NUnit.ConsoleRunner.Runner..cctor()
The action that failed was:
LinkDemand
The assembly or AppDomain that failed was:
nunit-console-runner, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77
The method that caused the failure was:
NUnit.Core.Logger GetLogger(System.Type)
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///E:/tmp/monogame-test/ProjectScaffold/packages/test/NUnit.Runners/tools/lib/nunit-console-runner.DLL
   --- End of inner exception stack trace ---
   at NUnit.ConsoleRunner.Runner.Main(String[] args)
   at NUnit.ConsoleRunner.Class1.Main(String[] args)
Running build failed.
Error:
NUnit test failed. Process finished with exit code FatalError (-532459699).

---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target         Duration
------         --------
Clean          00:00:00.0196215
AssemblyInfo   00:00:00.0271400
Build          00:00:06.7465036
CopyBinaries   00:00:00.0917006
Total:         00:00:33.2599529
Status:        Failure
---------------------------------------------------------------------
  1) Fake.UnitTestCommon+FailedTestsException: NUnit test failed. Process finished with exit code FatalError (-532459699).
   at Fake.NUnitSequential.NUnit(FSharpFunc`2 setParams, IEnumerable`1 assemblies) in C:\code\fake\src\app\FakeLib\UnitTest\NUnit\Sequential.fs:line 45
   at FSI_0005.Build.clo@145-11.Invoke(Unit _arg7) in E:\tmp\monogame-test\ProjectScaffold\build.fsx:line 146
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 489
Stift commented 8 years ago

I just tried it out and it seems to work.

But I have an assumption - your drive E: is an attached network drive (or a mapped drive in virtual box) and this may not trusted as execution environment. Check this: http://www.nigelthorne.com/2008/08/running-net-executable-from-network.html

Maybe as a first test just copy the stuff to a local drive and test it there.

simendsjo commented 8 years ago

Good guess, and it's quite correct :) I'll test this later as I don't have access to that computer now.

rdfedor commented 8 years ago

Ran into the same issue, reason it's happening is because nunit doesn't like being loaded via a network share for security reasons. You can reference this url,

http://stackoverflow.com/questions/4163615/get-net-to-consider-a-specific-network-share-to-be-fully-trusted

dsyme commented 7 years ago

THis is an external issue, unrelated to the scaffold