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

Notification

Icon
Error

NCrunch Build Failure of Unit Test Project
SamanthaLittle
#1 Posted : Thursday, April 29, 2021 11:26:38 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2021(UTC)
Posts: 4
Location: United Kingdom

Hello,

I have a Git Repository that NCrunch it refusing to build for me "Build failure", when all other developers on the exact same Git Repository are okay and NCrunch works for them.

All NCrunch settings are the same between developers.

The NCrunch popup shows "1 project is failing to build"

The offending project is a the Unit Test project in our Solution that builds in VS and builds in NCrunch for other developers, just not for me.

I have checked all NCrunch project files, cleaned Solution/Project, cleared Bin/Obj directories, rebuilt etc

The NCrunch Processing Queue shows this:

MainProduct.dll failed to load properly Could not resolve assembly 'System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Are you missing an assembly reference?


A little bemused why the Unit Test build is failing when the MainProduct.dll References the System.Web.Optimization Package correctly. Other developers do no get this and if I Reference the package in the Unit Test project it resolves this reference, I then get others :-(

QUESTION: Is there anything else I can look at or check to get to the bottom of this problem?

Any assistance would be greatly appecreciated

Kind regards,
Sam
Remco
#2 Posted : Thursday, April 29, 2021 11:34:04 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Sam,

Thanks for sharing this issue.

The .NET assembly resolution is an extremely complex monster with a wide range of environmental components that can cause assembly resolution to behave differently between machines, even when the same source code is involved.

Obtaining a full understanding of this issue would require a sample that would allow us to reproduce it so that we could trace through the build system. Given that the problem only appears on your machine but not that of other developers that share your codebase, there's a good chance that even if we have the repro, we may not be able to produce the problem. So it might take some questioning to resolve this issue.

Under the processing queue, can you confirm if the error appears on a build task? Or is it on an Analysis task?
michaelkroes
#3 Posted : Friday, April 30, 2021 3:59:43 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
Hi Sam,

Another thing to consider is deleting your nuget cache directory and restoring all the packages again. Occasionally this can get corrupt.
SamanthaLittle
#4 Posted : Friday, April 30, 2021 6:29:49 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2021(UTC)
Posts: 4
Location: United Kingdom

Hello,

Thank you for your responses, much appreciated.

I have tried a number of things like clearing the Nuget cache and clearing down all Packages to no avail. The solution is rebuilding okay.

In the NCrunch Processing Queue window was showing a Build Assembly - Failure on our main product DLL, but that has now shifted to a referenced MSGraph project where it is now the failure point in NCrunch:

[PID:36712 07:08:26.7308 ?-20] The package Microsoft.Graph with version 3.20.0 could not be found in C:\Users\XXXXXX\.nuget\packages\, C:\Program Files (x86)\Microsoft\Xamarin\NuGet\. Run a NuGet package restore to download the package.

This package does exist as is was restored correctly in the rebuild, but is C:\Program Files (x86)\Microsoft\Xamarin\NuGet\. in the error any thing to go on?

Thanks,
Samantha
Remco
#5 Posted : Friday, April 30, 2021 8:14:06 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Sam,

It's possible for a system to have multiple Nuget package roots. I don't think having the Xamarin path in the list should cause any problems. I think something critical is malfunctioning in your build system.

Try right-clicking on the failed project in the NCrunch Tests Window, then go to Advanced->Browse to workspace. In the workspace NCrunch has generated for the project, you should be able to find a modified project file.

Are you able to try building this project file using msbuild.exe? If the error shows up when you do this, it should give you a path through which you can analyse this problem without NCrunch's stack being involved. The generated project file should be largely the same as the original, though the dependencies on your other projects will be wired somewhat differently. If you can work out what needs to be changed in the project to get it to build in the workspace, this would help with identifying the source of the problem.
SamanthaLittle
#6 Posted : Friday, April 30, 2021 8:24:51 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2021(UTC)
Posts: 4
Location: United Kingdom

Hello,

That does give me something to go on.

I am not getting any errors when running MSBuild manually, but do have 1 warning which may be of significance:

warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Would a warning like this be enough to stop NCrunch from doing its thing?

In the mean time I will try and get that resolved to try and move things on.

Thanks,
Samantha
Remco
#7 Posted : Friday, April 30, 2021 11:03:42 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Sam,

I don't think the warning is related to the package resolution issue.

Could you try the following for me?

1. Start NCrunch, let it run until you see the failure
2. Go to your NCrunch configuration for the project that is failing
3. Set 'Build log verbosity' to 'Detailed'.
4. Go to your solution or general settings. Set 'Log verbosity' to 'Detailed'
5. Go to the failing project in the NCrunch Tests Window. Right click it, then choose to reload/rebuild it
6. Wait until the error appears again
7. Go to the NCrunch menu in VS, choose the 'Submit bug report' option. Add a description, then click the submit button

This will submit a log file containing information from the failed build of your project. Given how complex the build system is, this is no silver bullet for us in solving this problem .. but it will give me a little bit more information to work with.

Don't forget to set your logging settings back to default when you're done (as they can cause performance issues).
SamanthaLittle
#8 Posted : Wednesday, May 5, 2021 6:49:03 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/29/2021(UTC)
Posts: 4
Location: United Kingdom

Hello,

Very much appreciated all your help by the way...

I will submit a bug report as suggested in the meantime.

FYI This may be something to go on. We have multiple development Git Repository streams and and I am experiencing these on Stream2 of our Development, but NCrunch is working on Stream1. They are only different in respects of a slightly newer version with a couple of extra modules, but with the same Product.Tests project in Stream1 is working and NCrunch in Stream2 not.

I have compared the configurations side-by-side and all is the same.

Many thanks,
Samantha
Remco
#9 Posted : Wednesday, May 5, 2021 11:37:13 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Sam,

Thanks for submitting the bug report.

It looks like the error is coming from MSFakes.

Can you try removing and regenerating your fakes files for this solution? Sometimes they fall out of sync and strange things can happen.
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.072 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download