Encountering System.IO.PathTooLongException from Nunit 3.0.1 console runner

386 views
Skip to first unread message

Mike Long

unread,
Jan 19, 2016, 12:41:51 PM1/19/16
to NUnit-Discuss
I am encountering System.IO.PathTooLongException from the Nunit 3.0.1 console runner (installed via Nuget) and am looking for some troubleshooting advice. The powershell script we use to run the tests is working fine in all of our development and test environments except for on this one computer. The only paths that I can currently think of that might be causing issue are the path to console runner executable, the test assembly being passed to the executable on the command line and the path to the test run output log which are:
 
C:\workbench\product_ps\CAT\packages\NUnit.Console.3.0.1\tools\nunit3-console.exe
C:\workbench\product_ps\CAT\CompanyName.CAT.BusinessController.Test\bin\Release\CompanyName.CAT.BusinessController.Test.dll
C:\workbench\product_ps\autobuild\logs\nunit\companyname.CAT.BusinessController.Test.xml

*note ("product" and "companyname" have been used in place of actual product and company name but oddly enough they line up with the same number of characters.)

None of these paths individually seem to be threatening the 260 character max implied by the error message.

The output from the console runner is below:


NUnit Console Runner 3.0.5813
Copyright (C) 2015 Charlie Poole

Runtime Environment
   OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
  CLR Version: 4.0.30319.34209

Test Files
    C:\workbench\product_ps\CAT\companyname.CAT.BusinessController.Test\bin\Release\companyname.CAT.BusinessControl
ler.Test.dll --framework:net-4.0 --workers=2 --labels=all --work=C:\workbench\product_ps\autobuild\logs\nunit --res
ult=C:\workbench\product_ps\autobuild\logs\nunit\companyname.CAT.BusinessController.Test.xml;format=nunit2 --where=
(cat==unit)
    and
    (cat!=disabled)

System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name
must be less than 260 characters, and the directory name must be less than 248 characters.
   at System.IO.PathHelper.GetFullPathName()
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPath(String path)
   at NUnit.Engine.TestPackage..ctor(String filePath)
   at NUnit.Engine.TestPackage..ctor(IList`1 testFiles)
   at NUnit.ConsoleRunner.ConsoleRunner.MakeTestPackage(ConsoleOptions options)
   at NUnit.ConsoleRunner.ConsoleRunner.Execute()
   at NUnit.ConsoleRunner.Program.Main(String[] args)
 Not all tests passed

Any thoughts or suggestions would be welcome.

thanks for the consideration,
Mike


Charlie Poole

unread,
Jan 19, 2016, 1:13:54 PM1/19/16
to NUnit-Discuss
It seems as if a larger part of the command-line than you intend is
being parsed as a filename. Note what is listed under the heading
"Test Files"! Check that all arguments are delimited and args that
require quotes have them. It looks to me as if you may have quoted the
entire command-line, causing the entire quoted string to be passed as
a single argument.
> --
> You received this message because you are subscribed to the Google Groups
> "NUnit-Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nunit-discus...@googlegroups.com.
> To post to this group, send email to nunit-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/nunit-discuss.
> For more options, visit https://groups.google.com/d/optout.

Mike Long

unread,
Jan 19, 2016, 5:28:04 PM1/19/16
to NUnit-Discuss
ughh.... A sincere thank you Charlie! I noticed it in the output, but just didn't register the implication. It turns out the one system this was failing on was recently updated from Powershell 3 to Powershell 5. There has clearly been some changes in how it interprets the commandline executable + arguments call in our build script.

You just saved me some serious hair pulling.

thanks again,
Mike
Reply all
Reply to author
Forward
0 new messages