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

Notification

Icon
Error

Projects fail to build with no explanation
samholder
#1 Posted : Tuesday, January 15, 2013 12:01:38 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/11/2012(UTC)
Posts: 94

Thanks: 28 times
Was thanked: 12 time(s) in 12 post(s)
Hi,

Recently I have encountered an issue where some of my projects are failing to build in NCrunch, but NCrunch doesn't tell me anything about why it is. When I turn on logging and rebuild I get an error in the log like this:

[11:45:31.6581-BuildTask-13] ERROR (Internal): System.Exception: Unable to retrieve property values from expression in build output: $(OutDir)$(TargetName)$(TargetExt)

Server stack trace:
at #=qq057UXr4PIATPAy4_WMnj8Y3A2_53rdBo$hEl3XNc4uY9lTiWXMcCBMgbhzEmuXHMl1F5wHCYBkIhTdWRvU8Qw==.#=qECNZFVuR1q$byGsOnogeksbPQ4c2KkjfLDSuPeIRWIg=(IList`1 #=qBqZCqiCOUzGIBqj6nTyOOg==)
at #=qq057UXr4PIATPAy4_WMnj8Y3A2_53rdBo$hEl3XNc4v9IyT9eb1O_2SotxMUM$_GzmPqh_XDnWasGI7Xln04bw==.#=q3SF5nPR6_rAg3vy0cvHyqLAE$ws_oKXI7H_5wHEfrNE=.#=qsdPhz59wB6dP4rTxqm470VbG1mXYMhOe6SWl8rNLObd1Yv1O9BuvdarTdhS_o4Sz(#=qH5lrxEYDOp27HIoMXrRnzFPQZpqbfStdFeVfK0QiqrG5kmrXbioxN_6YUKhZRt6ZPRr_x_w_4Rs3y2_tvDbUAg== #=qT0FiTSk9fbOGeVsyc4sc4g==)
at nCrunch.Common.ListExtensions.Do[T](IEnumerable`1 list, Action`1 action)
at #=qq057UXr4PIATPAy4_WMnj8Y3A2_53rdBo$hEl3XNc4v9IyT9eb1O_2SotxMUM$_GzmPqh_XDnWasGI7Xln04bw==.#=qAw5L8XjFPZYWHKDj3irsQ03P5JDOS3iZaK7YIkR5GDK1mm9Y3qktsSZT1IZEoavy(IList`1 #=qjQ4LHIdQcSGWHIBxxSyshA==)
at #=qF__nrgFSpugB5cdcRrBB8aX6S$j$zadGkm1ofKS23p1dP8yli7jiI_aiylXfIpNd.#=qE1WBH8EOfeLXyWSfYLvSnY9Ex6S$xHQuHESNCBGHschzT$eO99i_6MYEVwL81SJh(IList`1 #=qx44P$UPdZqHEIHgHylxv7A==)
at nCrunch.Compiler.RemoteBuildRunner.Build(ComponentBuildParameters parameters)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at nCrunch.Compiler.IRemoteBuildRunner.Build(ComponentBuildParameters parameters)
at nCrunch.Core.BuildManagement.BuildProcessLauncher.#=qJmtoHHn$aPRkq$Zu2DzxVb7R4QCLgxDHex0Gg2DS0NU=.#=qAQvKATSuuHm5dTk2kyBAJx_fMHNwJvLLvwyxLa5q5ul4WwnvaI4yKZuxOEFHRgsk(IRemoteBuildRunner #=qbGicGic4r0TCt3HWEbPrPYc1n6krBSoqqH4hF7L3qQM=)
at nCrunch.Core.BuildManagement.BuildProcessLauncher.#=qz7KLtQQ$usprLC52KaPYfrEeQYIS_qr3b7zRRfCdiSPBwSE_BoXiyHuTi0zxU113(Action`1 #=q_PI0DtnsLczisG0R1eG$9Q==)
at nCrunch.Core.BuildManagement.BuildProcessLauncher.BuildComponentInExternalProcess(ComponentBuildParameters parameters)
at nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents)
at nCrunch.Core.BuildTask.DoProcessTaskAndReturnSuccessFlag()
at nCrunch.Core.Processing.ProcessingTask.ProcessTaskAndReturnSuccessFlag()
at nCrunch.Core.Processing.ProcessingQueue.#=q4XbnBBPK6QntuzrgVB0LyA==(ProcessingTask #=qC8g69jxn3pJi6ieBmpAINw==)

And I'm not sure what this means. We have recently started to use PostSharp but some of the projects which use postsharp build sucessfully so I don't think thats the issue.

The full build log is here: http://pastebin.com/t87uQqGa if that helps.
Remco
#2 Posted : Tuesday, January 15, 2013 9:36:11 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi,

Thanks for sharing this issue. I suspect that the structure of this project may somehow be different to that of projects that NCrunch was designed to run. I'm wondering if you can help narrow the problem down by answering the following questions:

- Can you tell me a bit more about the projects that are failing to build? Do they have anything in common?
- Do you remember which project template (i.e. from VS) was used to create the projects that are failing? (i.e. was it the C# Class Library?)
- I'm not sure as to the IP constraints within your environment, but is it possible to have a copy/paste of the XML that makes up the top part of the .proj file? (the part of the file containing the property declarations)
- Did this problem start suddenly, or has it always appeared for this particular solution? Did the solution ever work with NCrunch?

Something that could be very useful is if we're able to obtain a dump of the physical build output of the project. Right now the exception is masking this from the log, but we should be able to get something close by running MSBuild against the .proj file inside the NCrunch workspace. Try the following:

- Right click on the failed project, then choose 'Advanced->Browse To Workspace'
- Find the project file inside the workspace
- Using a command prompt, run 'MSBuild /v:d projectfile.proj > output.txt' (you may need to add MSBuild.exe to your command line path, it's usually in your .NET framework directory under Windows)
- Have a look at the output.txt file - copy/paste it here if possible


Cheers,

Remco
1 user thanked Remco for this useful post.
samholder on 1/28/2013(UTC)
samholder
#3 Posted : Tuesday, January 15, 2013 9:48:05 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/11/2012(UTC)
Posts: 94

Thanks: 28 times
Was thanked: 12 time(s) in 12 post(s)
Thanks remco. I can't do the output now as I'm not at work but I can answer some of the questions.

The project has always built in ncrunch before and this issue has just started recently. I'm not sure what caused it, though and haven't had time to investigate fully yet. It still builds on some of the other branches, so I can probably provide build output that is successful and one that's not..

The projects that are failing are mainly c# class libraries I believe.

I'll add the rest of the stuff in the morning and also check that the problem affects everyone in the team. I know it affects at least one other Dev.
Remco
#4 Posted : Tuesday, January 15, 2013 10:06:00 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Thanks for the prompt feedback. I have a feeling that the build is failing, but it's failing in such a way that NCrunch can't analyse the result. If we can capture the build output, this will likely hold a message we can use to further analyse the problem.
achillesuk
#5 Posted : Monday, January 21, 2013 11:57:02 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/21/2013(UTC)
Posts: 1
Location: United Kingdom

Hi,

This problem was found to be caused by implicit assembly dependencies amongst a number of projects:

proj A references proj B
proj B references proj C

Seems like NCrunch wants to have a direct reference to proj C, otherwise it can't compile proj A.
Referencing proj C to A directly resolved the issue.

The error was found using Remco's suggestion running MSBuild.

Cheers,
Achilles
Remco
#6 Posted : Monday, January 21, 2013 7:47:30 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi Achilles,

Thanks for posting the solution. I have a feeling that the issue here may be around postsharp requiring the output of project C to be present in the build output directory of project A, although this is speculation (as I'm still not sure what the underlying error was). Are you able to let me know if you're using the 'Copy referenced assemblies to workspace' option?

Sorry, I realised you've solved the problem already, although it's a goal to try and keep the NCrunch build as consistent as possible and patch holes where they exist.


Cheers,

Remco
1 user thanked Remco for this useful post.
samholder on 1/28/2013(UTC)
samholder
#7 Posted : Tuesday, January 22, 2013 8:21:26 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/11/2012(UTC)
Posts: 94

Thanks: 28 times
Was thanked: 12 time(s) in 12 post(s)
Actually it was the code analysis step that required the indirectly referenced assemblies. Not sure why visual studio was happy but msbuild e wasn't.

Thanks for helping us track it down and thanks to achilles for making the time to find the error cause of the problem.
1 user thanked samholder for this useful post.
Remco on 1/23/2013(UTC)
samholder
#8 Posted : Tuesday, February 19, 2013 6:57:48 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/11/2012(UTC)
Posts: 94

Thanks: 28 times
Was thanked: 12 time(s) in 12 post(s)
Whilst this provided a way to solve this problem, it seems that we shouldn't need to do this I don't think. we are getting output.txt which contained a entries along the lines of:

Dependency "PostSharp, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7".
Could not resolve this reference. Could not locate the assembly "PostSharp, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

And this it seems is enough for NCrunch to fail the build, but actually this dependency is not needed. We have ended up having to add a lot of references to our projects just to satisfy NCrunch which isn't great.

Could you confirm that this is the behaviour and could we have the option to change it?
Remco
#9 Posted : Tuesday, February 19, 2013 9:55:25 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi Sam,

This error is being thrown by postsharp itself. Because NCrunch constructs workspaces using only the dependencies it knows about, a tool such as postsharp (that has an implicit dependency on the PostSharp.dll) is an extra consideration that needs to be treated with an additional reference for NCrunch. There's more information about this in the documentation around project atomicity.

Something you may find is that if you try to build any of your projects in isolation without the postsharp.dll present with the project, it will also fail to build. The PostSharp binary is required and your primary build is working because it searches for the file and finds it implicitly. Adding a reference to it is one way of ensuring the assembly exists in NCrunch's workspace when building with NCrunch (and is probably the approach I would recommend), although you may also be able to do this using the 'Additional files to include' configuration setting. Unfortunately I can't guide you though all the details of what is happening as I'm not myself very familiar with the inner workings of postsharp.

I hope this brings some reason to the madness :)


Cheers,

Remco
samholder
#10 Posted : Tuesday, February 19, 2013 10:16:09 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/11/2012(UTC)
Posts: 94

Thanks: 28 times
Was thanked: 12 time(s) in 12 post(s)
I used post sharp as an example here but we have several other dlls which also seem to be causing the same issue. I must have had to addfive or six references to implicit dependencies in some projects. And wo betide anyone who tries to clean up the references :).

So basically what you are saying is that the implicit dependency resolution succeeds in visual studio because it happens to be able to find the references but in the ncrunch workspace the dlls are not available. Unless we explicitly add them.

There seems to be a lot of dependencies have this issue and I'm sure this is related to having code analysis enabled, which seems to require the dependencies of the dependencies to be available.
Remco
#11 Posted : Tuesday, February 19, 2013 10:40:13 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
What you're describing isn't normal. NCrunch uses the build process itself to identify dependencies of projects, and in turn the dependencies of dependencies. This means the workings inside the NCrunch workspace should be more or less equivalent to that of your foreground solution - minus any implicit behaviour.

I'm wondering if perhaps either the code analysis or the postsharp manipulation is relying on the dependencies of dependencies to be present inside the project's build output directory. Does turning on the 'Copy referenced assemblies to workspace' option for all the projects in your solution solve this problem?

If this is being caused by code analysis, it may be worth suppressing this analysis for NCrunch builds using conditional compilation.
samholder
#12 Posted : Tuesday, February 19, 2013 10:49:22 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/11/2012(UTC)
Posts: 94

Thanks: 28 times
Was thanked: 12 time(s) in 12 post(s)
Thanks. I'll try and get a full output text file to see if that helps shed any light on the problem.

I might try to disable code analysis in ncrunch to see if that solves it but actually that provides useful feedback and so I'm a bit loath to do that.

Thanks again for the great support!
1 user thanked samholder for this useful post.
Remco on 2/20/2013(UTC)
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.082 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download