Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NCrunch Servernode doesn't build correctly (x64/x86)
Inker
#1 Posted : Friday, May 9, 2014 5:26:31 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/9/2014(UTC)
Posts: 17
Location: Austria

Thanks: 6 times
Was thanked: 4 time(s) in 4 post(s)
Hi,

I'm running into some weird issues when building my projects on an ncrunch server node.
My solution is configured for AnyCpu (for all projects)
My dev. machine is Win8.1 x64 pro, locally everything works fine.
The server node is a Win8.1 x86 machine. I installed VS2013 and all required SDKs on it (specifically Code Contracts in my case).

Now when that server node builds any project, it seems to build and run my tests, but in the NCrunch Test window I get a whole bunch of errors/warnings stating:
Quote:
NCrunch: The following files are expected but do not seem to exist on the computer responsible for building this project:
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.CSharp.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.CSharp.CurrentVersion.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.targets
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets
C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.props
[.....tons more......]
Please make sure you have all SDKs required to build this project installed on this computer.


I have no idea why it wants to look in the x86 folder which doesn't exist on an x86 machine. Is that somehow synced over from the client?

The interesting thing is, it still seems to build and run my tests.
Here's what's more interesting, if in the NCrunch options I select x64, it still builds and the errors/warnings go away (I think then it just looks into Program Files because it thinks it's on an x64 machine and that's where x64 stuff resides).
Also, when I create a symlink (manually) on the server that points from C:\Program Files (x86) to C:\Program Files the warnings go away too (back to x86 config in nCrunch for that project)

Despite the fact that it still seems to work (....somehow....), this is bothering me for two reasons:
First, I don't like warnings/errors.

And second, more importantly I have some tests that check CC thrown exception (ArgumentExceptions) and to ensure I'm not catching some other weird exception I check the Exception refers to the expected parameter.
I think the output assembly is somehow marked as x64, and CC is super confused when build in this manner and mangles up strings.
The Param property of the exception is suddenly null, and the Message property looks something like this:
Quote:
System.ArgumentException: "Precondition failed: s t r i n g u s e r N"

instead of
Quote:
System.ArgumentException: Precondition failed: !string.IsNullOrWhiteSpace(userName)


The whitespace in there is \0

This makes my tests fail when run on that server node.

I don't expect you to fix some weird CC rewriter issue, but I think the root problem is just that NCrunch on that server node somehow thinks its on an x64 machine and compiles things in a weird way. To be clear, everything seems to work perfectly locally (unfortunatly I don't have an x64 server that I could try this on).

Any advice?

Edit: I forgot to mention I can repro this with an fresh solution/project (and without using any CC)
I still get all the warnings. I saved a detailed log from the node if you need it.
Remco
#2 Posted : Friday, May 9, 2014 10:28:20 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing these issues.

The warnings NCrunch is giving you about the missing files are nothing you need to be worried about. The only issue here is that the message NCrunch is giving you is not well worded, and it tends to suggest that it's throwing warnings/errors while actually it's just trying to give information that can be useful in troubleshooting a build problem.

Basically, when NCrunch builds the project on your local machine, it identifies all files loaded into MSBuild during build time. This can include a large number of target files that may not actually be needed to build the project, but are included anyway. NCrunch cannot reliably tell which files are required for the build to function normally, so it simply notes them all. These files are then compared against the build targets used on the grid node, and differences are reported. As you've correctly described, in this particular case the differences exist because the targets files are being loaded from a different path (the (x86) program files dir) on the local machine vs the grid node.

I'm looking at revising the wording in this message to make its purpose clearer. There's nothing you need to do to correct the problem, as there is actually no problem at all :)

The second issue you're described sounds more serious. I'm not sure if this is related to an x86/x64 difference, although with code contracts, it can often be hard to tell. How was code contracts installed on the grid node? Was this done using a method that was different to your local machine? It may be worth trying to compare the assemblies that are output from ccrewrite (on your local machine vs the grid node) to see if there is a difference in how the rewriter is working. It's quite possible this is a subtle configuration or installation issue directly related to code contracts.
1 user thanked Remco for this useful post.
Inker on 5/9/2014(UTC)
Inker
#3 Posted : Friday, May 9, 2014 11:14:41 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/9/2014(UTC)
Posts: 17
Location: Austria

Thanks: 6 times
Was thanked: 4 time(s) in 4 post(s)
Remco;5830 wrote:

I'm looking at revising the wording in this message to make its purpose clearer. There's nothing you need to do to correct the problem, as there is actually no problem at all :)

I see, well that's good then. Perhaps only output those messages if Logging is set to Detailed or something then, it's a bit misleading now (and, well, I don't like warnings) :-)

Remco;5830 wrote:

The second issue you're described sounds more serious. I'm not sure if this is related to an x86/x64 difference, although with code contracts, it can often be hard to tell. How was code contracts installed on the grid node? Was this done using a method that was different to your local machine? It may be worth trying to compare the assemblies that are output from ccrewrite (on your local machine vs the grid node) to see if there is a difference in how the rewriter is working. It's quite possible this is a subtle configuration or installation issue directly related to code contracts.

Well after I installed VS I just ran the CC installer. It's been a while since I installed them locally, but I don't think I did anything different.

In the meantime I found that if I give CC a message string when explicitly throwing an ArgumentException it put's it into the ArgumentExceptions ParamName property instead of the message.
Anyways, this strings "survivors" (no weir \0) so it enabled me to fix those tests up (and it's a bit cleaner than checking the auto generated message anyways).

I just wish MS would pick up CC and give it first class support in the compiler. I absolutely love the concept, but you run into so many quirks due to the need for the rewriter :-(
Anyways, thanks for the response, I should have tried to find this workaround before posting here.

Keep up the good work, assuming no showstoppers show up when I try to use it day to day over the next week or so, you've won a customer for sure :-)
Loving this thing!
Remco
#4 Posted : Friday, May 9, 2014 11:36:31 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks!! I'm glad to hear that you managed to get it working. Something I will quickly warn you about with code contracts is that it can have a significant impact on build performance, especially if you're its static analysis features. MS didn't really design it with fast building tools like NCrunch in mind, so I guess this is something you might need to balance with your contract needs.

I'm glad you're enjoying NCrunch. I hope it continues to work well for you :)

Cheers,

Remco
Inker
#5 Posted : Friday, May 9, 2014 11:41:17 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/9/2014(UTC)
Posts: 17
Location: Austria

Thanks: 6 times
Was thanked: 4 time(s) in 4 post(s)
Thanks, well CC is baked really deep into this solution, I have been using CC for a long time now.

The runtime rewriter isn't too bad, it actually works remarkably well for me in combination with nCrunch.

I do static analysis on some selected assemblies with a separate build config (that also builds on the TeamServer nightly). But your right, you absolutely don't want that turned on for "normal" coding.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.051 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download