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

Notification

Icon
Error

NCrunch complains about constructor param count, but has wrong count
johnmwright
#1 Posted : Tuesday, April 24, 2012 1:36:14 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/27/2011(UTC)
Posts: 45
Location: Chicago, IL

Thanks: 3 times
Was thanked: 7 time(s) in 6 post(s)
Started using NCrunch on a new C# project today and saw an error:

NCrunch is failing to build the module with the following error:
Controls\TestFooCodeBehind.cs (81): 'MyNamespace.Common.EntityMapping.EntityMapper' does not contain a constructor that takes 2 arguments

EntityMapper indeed has only a single constructor, which takes three arguments:

public EntityMapper(Session session, IServiceProxy service, ITracingService tracingService) {/* code */}

However, the call on line 81 of TestFooCodeBehind.cs actually has three parameters in it, not two as NCrunch states: (note: I added line numbers to the front of each line)

78 backgroundWindow.DoWork += delegate
79 {
80
81 var mapper = new EntityMapper(session,
82 Authentication.CurrentSession, null);

Visual Studio is able to compile without issue, there are no overloads of the constructor or any optional params, and EntityMapper does not have any base classes or implement any interfaces.

However, when I removed the line break, combining line 81 and 82 into a single line, the error went away. Putting the line break back did not cause the error to return.

I'm running NCrunch v1.38.0.17b in VS 2010 Premium v4.0.30319 SP1Rel
Remco
#2 Posted : Tuesday, April 24, 2012 10:08:44 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 John,

I suspect this is caused by the same issue you've highlighted in your other thread - http://forum.ncrunch.net...-before-base-class.aspx

When you experience this issue, is it generally between classes that are being referenced across project/assembly boundaries?
johnmwright
#3 Posted : Wednesday, April 25, 2012 2:22:57 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/27/2011(UTC)
Posts: 45
Location: Chicago, IL

Thanks: 3 times
Was thanked: 7 time(s) in 6 post(s)
For this specific case, the class which is failing to compile (TestFooCodeBehind) is in a different project/assembly than the EntityMapper class. Unlike the items I mentioned in the other thread, I haven't seen this one reoccur, but it does seem related. If it does happen again, I'll submit a bug report via the NCrunch menu and update this post.
1 user thanked johnmwright for this useful post.
Remco on 4/25/2012(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.026 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download