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

Notification

Icon
Error

NCrunch fails to build when referencing project in a solution, but works fine with the assembly
kasperhj
#1 Posted : Friday, January 23, 2015 3:24:51 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/23/2015(UTC)
Posts: 4
Location: Denmark

I have an F# project that that test in another project, both within the same solution.

NCrunch cannot build the project, and is interpreting argument input type to be tuple instead of single arguments.
If I remove the tests with the mixed up arguments, I get the following exception

System.TypeInitializationException : The type initializer for 'GenericZeroDynamicImplTable`1' threw an exception.
----> System.NullReferenceException : Object reference not set to an instance of an object.
at Microsoft.FSharp.Core.LanguagePrimitives.GenericZeroDynamic[T]()
at Lib.DoStuff[a,a](IEnumerable`1 spectrum) in C:\src\code\code\Functions.fs:line 22
[.....]
--NullReferenceException
at Microsoft.FSharp.Core.LanguagePrimitives..cctor$cont@2366-3[T](Type aty, Unit unitVar)
at Microsoft.FSharp.Core.LanguagePrimitives.GenericZeroDynamicImplTable`1..cctor()

There could be a problem with the LanguagePrimitives?

Now, if I instead of referencing the project I reference its DLL, NCrunch builds and is able to run all tests.

What do you think could be the problem and is there a solution?
Remco
#2 Posted : Friday, January 23, 2015 9:03:30 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,

Thanks for sharing this issue.

This looks to be pretty internal to F# .. I don't know of anything in NCrunch that would directly cause this problem. Likely it's something within F# itself that is manifesting in response to NCrunch's environment.

Have you tried running the solution in compatibility mode to see if this makes any difference? Perhaps if we can narrow down the NCrunch feature that is manifesting the issue, I may be able to advise on how to work around it.
kasperhj
#3 Posted : Monday, February 2, 2015 8:38:11 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/23/2015(UTC)
Posts: 4
Location: Denmark

I have now tried to run it in compatibility mode, but the result is the same - build error.
I have tried another test suite, and here there is no problem. Everything builds and the tests passes.
Remco
#4 Posted : Monday, February 2, 2015 8:41:02 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)
Are you able to reproduce this issue using some sample code? If so, you're welcome to submit it via the contact form (https://www.ncrunch.net/support/contact) and I'll see if I can find a resolution.
kasperhj
#5 Posted : Monday, February 2, 2015 10:09:24 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/23/2015(UTC)
Posts: 4
Location: Denmark

While trying to generate some sample code, I found out that the build issued by NCrunch does not seem to reflect the current source code. I.e. it fails building a test function which no longer exists and specifies a line number which is now a comment. Is there a way to clean NCrunch so I can rule out this issue first?
Remco
#6 Posted : Monday, February 2, 2015 11:26:11 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)
Make sure that you're using project references between your projects - not assembly references. This is a common reason for building against old code.

Which version of Visual Studio are you using? If you can submit the sample code (also for the second issue), I may be able to narrow this down faster.
kasperhj
#7 Posted : Monday, February 2, 2015 4:41:23 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/23/2015(UTC)
Posts: 4
Location: Denmark

I reference the project. I am using Visual Studio Ultimate 2013.
I cannot seem to reproduce the error with sample code, but I've found out, that compiling core project with the '--standalone' switch, makes NCrunch compile.
This requires me to change the method calls from `SomeFunc arg1 arg2` to `SomeFun(arg1, arg2)`.
Remco
#8 Posted : Monday, February 2, 2015 11:09:00 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)
Nice work on finding a solution. Something that may help with your deduction would be to take a look at the code that NCrunch generates inside its workspaces. You can access this code by right-clicking on any built assembly, then going to Advanced->Browse to workspace. NCrunch essentially just runs MSBuild.exe against the project file in this workspace, so if you are able to reproduce the problem in this way, you may be able to compare the content/structure of the workspace with your own code to see which difference is creating the problem. NCrunch itself doesn't manipulate any of your code, but it will change the project file to rewrite the references.
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.047 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download