Bug 23962 - nunit-console crashes when running csproj files
Summary: nunit-console crashes when running csproj files
Status: RESOLVED ANSWERED
Alias: None
Product: Tools
Classification: Mono
Component: other ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-10-21 12:55 UTC by delcypher
Modified: 2017-08-31 16:01 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description delcypher 2014-10-21 12:55:46 UTC
I'm not sure if this is the right place to report this because this is outside mono develop but its the only place I could find mention of a "NUnit" component.

The ``nunit-console`` tool has the ability to run on ``.csproj`` files but trying to do that on Monodevelop generated csproj files crashes the nunit-console tool. The issue is the tool is trying to mix UNIX paths on my system with the Windows style paths in the csproj file.


```
$ nunit-console4 ~/dev/foo/LibTests/SymbooglixLibTests.csproj
NUnit version 2.4.8
Copyright (C) 2002-2007 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment - 
   OS Version: Unix 3.16.4.1
  CLR Version: 4.0.30319.17020 ( 3.10.0 (tarball Mon Oct  6 20:46:04 UTC 2014) )

Unhandled Exception:
System.IO.DirectoryNotFoundException: Directory "/home/dsl11/dev/foo/LibTests/bin\Debug" not found.

Server stack trace: 
  at System.IO.Directory.SetCurrentDirectory (System.String path) [0x0005c] in /build/mono/src/mono-3.10.0/mcs/class/corlib/System.IO/Directory.cs:423 
  at System.Environment.set_CurrentDirectory (System.String value) [0x00000] in /build/mono/src/mono-3.10.0/mcs/class/corlib/System/Environment.cs:169 
  at NUnit.Core.DirectorySwapper..ctor (System.String directoryName) [0x00027] in /build/mono/src/mono-3.10.0/mcs/nunit24/NUnitCore/core/DirectorySwapper.cs:36 
  at NUnit.Core.Builders.TestAssemblyBuilder.Load (System.String path) [0x00002] in /build/mono/src/mono-3.10.0/mcs/nunit24/NUnitCore/core/Builders/TestAssemblyBuilder.cs:162 
  at NUnit.Core.Builders.TestAssemblyBuilder.Build (System.String assemblyName, Boolean autoSuites) [0x00000] in /build/mono/src/mono-3.10.0/mcs/nunit24/NUnitCore/core/Builders/TestAssemblyBuilder.cs:96 
  at NUnit.Core.Builders.TestAssemblyBuilder.Build (System.String assemblyName, System.String testName, Boolean autoSuites) [0x00016] in /build/mono/src/mono-3.10.0/mcs/nunit24/NUnitCore/core/Builders/TestAssemblyBuilder.cs:76 
  at NUnit.Core.TestSuiteBuilder.Build (NUnit.Core.TestPackage package) [0x000c5] in /build/mono/src/mono-3.10.0/mcs/nunit24/NUnitCore/core/TestSuiteBuilder.cs:85 
  at NUnit.Core.SimpleTestRunner.Load (NUnit.Core.TestPackage package) [0x0000b] in /build/mono/src/mono-3.10.0/mcs/nunit24/NUnitCore/core/SimpleTestRunner.cs:107 
  at NUnit.Core.ProxyTestRunner.Load (NUnit.Core.TestPackage package) [0x00000] in /build/mono/src/mono-3.10.0/mcs/nunit24/NUnitCore/core/ProxyTestRunner.cs:104 
  at NUnit.Core.ProxyTestRunner.Load (NUnit.Core.TestPackage package) [0x00000] in /build/mono/src/mono-3.10.0/mcs/nunit24/NUnitCore/core/ProxyTestRunner.cs:104 
  at NUnit.Core.RemoteTestRunner.Load (NUnit.Core.TestPackage package) [0x0005b] in /build/mono/src/mono-3.10.0/mcs/nunit24/NUnitCore/core/RemoteTestRunner.cs:45 
  at (wrapper xdomain-dispatch) NUnit.Core.RemoteTestRunner:Load (object,byte[]&,byte[]&)
```
Comment 1 delcypher 2014-10-21 13:15:24 UTC
Huh turns out there's an easy to workaround this that I only just discovered. You can set a specially environment variable that causes Mono to try and fix the paths

```
$ MONO_IOMAP=all nunit-console4 ~/dev/foo/LibTests/SymbooglixLibTests.csproj
```

Hope that helps someone.
Comment 2 Mikayla Hutchinson [MSFT] 2014-10-21 15:37:12 UTC
This is a bug in the old version of NUnit bundled with Mono.

I'd recommend downloading the latest via NuGet.
Comment 3 delcypher 2014-10-21 15:55:22 UTC
@Michael - This isn't a complete solution

* 2.6.3 has this bug too. I built it from source [1] and the bug is still there.

* I'm rather to new NuGet but doesn't this add it to solution rather than installing it globally? Anyway I tried this. There seems to be an NUnit.Runners package but when I can add but Monodevelop keeps removing it (from the solution pane) when I right click it and click update because it says that my project does not depend on it. The version that NuGet downloads has this bug too.


[1] https://github.com/delcypher/nunitv2/tree/2.6.3-fixed
Comment 4 Marek Safar 2017-08-31 16:01:45 UTC
Bundled nunit with Mono is deprecated and will be removed please use nuget to obtain the recent version