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

Notification

Icon
Error

Build failure issue - 'Class1' does not contain a definition for 'Property2'
talwarn
#1 Posted : Wednesday, August 8, 2012 3:15:21 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/8/2012(UTC)
Posts: 1

Hello there,

I am trying to run my unit tests using NCrunch,
however one of the project build is failing with following error -

Quote:
'Class1' does not contain a definition for 'Property2'

'Class1' does not contain a definition for 'Property2' and no extension method 'Property2' accepting a first argument of type 'Class1' could be found (are you missing a using directive or an assembly reference?)

Class1 is defined as -
Code:

    public class Class1
    {
        public List<SomeCustomObject11> Property1 { get; set; }
        public List<SomeCustomObject22> Property2 { get; set; }
    }


Quite surprisingly, no error is thrown for Property1.

Wondering why the error is thrown only for Property2,
Can anyone please guide what could be the issue?

Thank you!
Remco
#2 Posted : Wednesday, August 8, 2012 9:55:44 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for posting!

If this error is appearing consistently (i.e. you can never get the project to build), then my first thought would be that your build environment may have some hidden complexity around project/assembly resolution.

Can you share any more information about how this class is being referenced from other projects within your solution? Do you have any custom build steps or are you using any interesting frameworks that may implement alternative logic around reference resolution?


Thanks!

Remco
breinke
#3 Posted : Wednesday, August 29, 2012 9:29:01 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/29/2012(UTC)
Posts: 1

I have the same issue, and perhaps a clue.

I've written a C# console app in Visual Studio 2010, "Driver". The Driver is intended to feed work into a publishing system, defined in a local reference (dll) "actify.publishing.system".

I used Visual Studio's built-in ability to "Create Unit Tests...". That created class"Driver.Driver_Accessor" to access the private members of my "Driver" class, which made it easy to write a complete set of unit tests.

I just installed NCrunch, and it insists that my DriverTest project is "failing to build". The error message is "'Driver.Driver_Accessor' does not contain a definition for 'AddJobProperties'", and five similar messages.

My class has many members that do not provoke this error. The six members that do provoke errors use types defined in the local reference, for example actify.publishing.system.PublishingJob. The others uses "standard" types like bool, string, Dictionary, DataTable.

Seems to be something wrong with how NCrunch handles local references in this case.
Remco
#4 Posted : Thursday, August 30, 2012 12:24:36 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Does it make any difference if you turn on the 'Copy Referenced Assemblies To Workspace' setting for all the projects in your solution? MS Test private accessors require this, and NCrunch should usually turn it on implicitly, though this doesn't seem to be working reliably in the current build.
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.038 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download