Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error locally #992

Closed
mastoj opened this issue Nov 1, 2015 · 17 comments
Closed

Build error locally #992

mastoj opened this issue Nov 1, 2015 · 17 comments

Comments

@mastoj
Copy link
Contributor

mastoj commented Nov 1, 2015

Just cloned the master repo on Windows and ran build.cmd. The build fails with the following exception:

Failures:                                                                     

compile csfiles to dll                                                        
» should compile to dll (FAIL)                                                
Fake.MSBuildHelper+BuildException: Exception of type 'Fake.MSBuildHelper+Build
Exception' was thrown.                                                        
   at Fake.CscHelper.Csc(FSharpFunc`2 setParams, FSharpList`1 inputFiles) in C
:\Dev\git\FAKE\src\app\FakeLib\CscHelper.fs:line 125                          
   at Test.FAKECore.compile_csfiles_to_dll.<>c.<.ctor>b__8_2() in C:\Dev\git\F
AKE\src\test\Test.FAKECore\CscSpecs.cs:line 60                                

Contexts: 250, Specifications: 670, Time: 23.77 seconds                       
  666 passed, 1 failed, 3 ignored                                             
Running build failed.                                                         
Error:                                                                        
System.Exception: MSpec test failed on C:\Dev\git\FAKE\test\Test.Fake.Deploy.dll, C:\Dev\git\FAKE\test\Test.Fake.Deploy.Web.dll, C:\Dev\git\FAKE\test\Test.Fake.Deploy.Web.File.dll, C:\Dev\git\FAKE\test\Test.FAKECore.dll, C:\Dev\git\FAKE\test\Test.Git.dll.                                                         
   at Microsoft.FSharp.Core.Operators.FailWith[T](String message)             
   at Fake.MSpecHelper.MSpec(FSharpFunc`2 setParams, IEnumerable`1 assemblies)

   at [email protected](Unit _arg6) in C:\Dev\git\FAKE\build.fsx:line 139                                                                     
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target)              

It says on github that it passes, so it is a little bit weird that it doesn't when I run it locally.

@bentayloruk
Copy link
Contributor

I've just had this fail for me too. In my case, I believe it is caused by there being a space in my username. The test in question uses Path.GetTempPath() and then combines this path with file names and passes to csc.exe. The temp paths are not quoted in the generated command, so csc is not invoked correctly. I will dig into it and PR if I have the time, but thought I'd mention it here too.

@mastoj
Copy link
Contributor Author

mastoj commented Jan 15, 2016

@bentayloruk, you might be on something. I didn't do any further investigation, but I do have a space in my username.

@bentayloruk
Copy link
Contributor

I'm hacking on a fix at the moment. Will keep you posted.

bentayloruk added a commit to bentayloruk/FAKE that referenced this issue Jan 15, 2016
Tests invoking csc.exe were failing when GetTempPath paths contained a
space.  Updated csc invocation to quote references, output path and
input file paths.
@bentayloruk
Copy link
Contributor

OK, now works for me. If you want to try it out, this branch is the latest from upstream, plus this fix. This is the fix commit bentayloruk@7da8996

I've just hacked this in and have not reviewed it. Retiring for the evening, but will submit a PR tomorrow. I had to fix this, so I could submit a different PR I want for something else :-)

@bentayloruk
Copy link
Contributor

Given that Csc is public and could be in use from scripts that have explicitly quoted the path, I think I'll update to check the state of the provided paths first. Don't want to break a load of existing scripts with double quoting.

@bentayloruk
Copy link
Contributor

@mastoj are you able to run all the MSpec tests in Visual Studio? build.cmd is building and passing tests, but if I use the R# runner or the MSpec test adapter all the tests involving files fail with path issues and DirectoryNotFoundExceptions. For example:

Test Name:  should find the base dir
Test FullName:  Test.FAKECore.Globbing.TestSample1.when_using_empty_pattern::should_find_the_base_dir
Test Source:    c:\Build\FAKE\src\test\Test.FAKECore\Globbing\TestSample1\FileSetSample1Specs.cs : line 75
Test Outcome:   Failed
Test Duration:  0:00:00

Could not find a part of the path 'C:\Users\Bob TheBuilder\AppData\Local\Temp\e8f772a3-c964-4127-8ba3-59758cbbea7e\e8f772a3-c964-4127-8ba3-59758cbbea7e\assembly\dl3\8b1f6ef0\2279a060_3e50d101\Globbing\TestSample1\SampleApp.zip'.
Result StackTrace:  
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at ICSharpCode.SharpZipLib.Zip.ZipFile..ctor(String name)
   at Fake.ZipHelper.Unzip(String target, String fileName) in C:\Build\FAKE\src\app\FakeLib\ZipHelper.fs:line 89
   at Test.FAKECore.Globbing.TestSample1.when_extracting_zip.<.ctor>b__0() in c:\Build\FAKE\src\test\Test.FAKECore\Globbing\TestSample1\GlobbingSample1Specs.cs:line 15

@mastoj
Copy link
Contributor Author

mastoj commented Jan 16, 2016

I can try to get some time today or tomorrow to test it out.
On Jan 16, 2016 10:22, "Ben Taylor" [email protected] wrote:

@mastoj https://github.com/mastoj are you able to run all the MSpec
tests in Visual Studio? build.cmd is building and passing tests, but if I
use the R# runner or the MSpec test adapter
https://visualstudiogallery.msdn.microsoft.com/f8d80e41-0a85-4b04-aa41-0bc59dc81a5a
all the tests involving files fail with path issues and
DirectoryNotFoundExceptions. For example:

Test Name: should find the base dir
Test FullName:
Test.FAKECore.Globbing.TestSample1.when_using_empty_pattern::should_find_the_base_dir
Test Source:
c:\Build\FAKE\src\test\Test.FAKECore\Globbing\TestSample1\FileSetSample1Specs.cs
: line 75
Test Outcome: Failed
Test Duration: 0:00:00

Could not find a part of the path 'C:\Users\Bob TheBuilder\AppData\Local\Temp\e8f772a3-c964-4127-8ba3-59758cbbea7e\e8f772a3-c964-4127-8ba3-59758cbbea7e\assembly\dl3\8b1f6ef0\2279a060_3e50d101\Globbing\TestSample1\SampleApp.zip'.
Result StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at ICSharpCode.SharpZipLib.Zip.ZipFile..ctor(String name)
at Fake.ZipHelper.Unzip(String target, String fileName) in C:\Build\FAKE\src\app\FakeLib\ZipHelper.fs:line 89
at Test.FAKECore.Globbing.TestSample1.when_extracting_zip.<.ctor>b__0() in c:\Build\FAKE\src\test\Test.FAKECore\Globbing\TestSample1\GlobbingSample1Specs.cs:line 15


Reply to this email directly or view it on GitHub
#992 (comment).

@bentayloruk
Copy link
Contributor

@mastoj thanks. Would be good to know my setup is borked, I've missed a step, or whether the MSpec test failures are also due to username space issues too. Just want to know if you are able to run all the MSpec tests from within Visual Studio.

@forki
Copy link
Member

forki commented Jan 16, 2016

FYI on my machine VS isn't compiling fake as well. Only build.cmd works.
Need to fix that one day.
On Jan 16, 2016 10:27, "Ben Taylor" [email protected] wrote:

@mastoj https://github.com/mastoj thanks. Would be good to know my
setup is borked, I've missed a step, or whether the MSpec test failures are
also due to username space issues too. Just want to know if you are able to
run all the MSpec tests from within Visual Studio.


Reply to this email directly or view it on GitHub
#992 (comment).

@bentayloruk
Copy link
Contributor

@forki good to know, thanks! FAKE is compiling fine for me in VS, I just have 254 failed tests (with 412 passing). Is that what you have or are you not even actually compiling?

@forki
Copy link
Member

forki commented Jan 16, 2016

For me it's not even compiling in VS.

But compile + tests run fine in build. Just send your PRs and we see if
it's working on appveyor and Travis
On Jan 16, 2016 10:39, "Ben Taylor" [email protected] wrote:

@forki https://github.com/forki good to know, thanks! FAKE is compiling
fine for me in VS, I just have 254 failed tests (with 412 passing). Is that
what you have or are you not even actually compiling?


Reply to this email directly or view it on GitHub
#992 (comment).

@bentayloruk
Copy link
Contributor

Thanks, will do. I was just hoping to debug through one of them in VS :-)

@forki
Copy link
Member

forki commented Jan 16, 2016

Yeah I think the project files broke on VS update. Maybe they should look
like paket's fsproj files.
On Jan 16, 2016 10:47, "Ben Taylor" [email protected] wrote:

Thanks, will do. I was just hoping to debug through one of them in VS :-)


Reply to this email directly or view it on GitHub
#992 (comment).

bentayloruk added a commit to bentayloruk/FAKE that referenced this issue Jan 16, 2016
Tests invoking csc.exe were failing when paths contained a
space.  Updated csc invocation to ensure quote references, output path and
input file paths when a space is detected and not already quoted.
bentayloruk added a commit to bentayloruk/FAKE that referenced this issue Jan 16, 2016
Don't think anyone would intentionally pad a path and doubt Csc would care if they did, so trim paths.  This change avoids us quoting a path that is quoted, but with whitespace at one end, the other or both.
@mastoj
Copy link
Contributor Author

mastoj commented Jan 16, 2016

Now I get the same result as you @bentayloruk, it builds fine in VS but the mspec tests doesn't run.

@bentayloruk
Copy link
Contributor

@mastoj I have the MSpec tests running, using the R# test runner. I installed the MSpec runner for R# and then had to turn off Shadow-copy assemblies being tested in the R# Options (Tools -> Unit Testing).

@forki
Copy link
Member

forki commented Jan 16, 2016

is there a way to add the R# settings to the repo?

2016-01-16 23:00 GMT+01:00 Ben Taylor [email protected]:

@mastoj https://github.com/mastoj I have the MSpec tests running, using
the R# test runner. I installed the MSpec runner for R# and then had to
turn off Shadow-copy assemblies being tested in the R# Options (Tools
-> Unit Testing).


Reply to this email directly or view it on GitHub
#992 (comment).

bentayloruk added a commit to bentayloruk/FAKE that referenced this issue Jan 17, 2016
FAKE tests that depend on files can't be run when R# is set to shadow copy assemblies being tested.  This file switches this off for all R# users that have the shared sln settings enabled.

Requested by @forki in fsprojects#992.

NOTE:  This means you can't build the sln, while your tests are running.
@bentayloruk
Copy link
Contributor

The R# sln file should fix things for a lot of people using the R# runner. However, us idiots with spaces in our usernames, will still need PR #1076 to fix this issue.

@forki forki closed this as completed in 08ca88b Jan 17, 2016
forki added a commit that referenced this issue Jan 17, 2016
Fix #992 test failure when space in temp path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants