Note that there are some explanatory texts on larger screens.

plurals
  1. POClass will compile for Tests/Console but not in Asp.net application
    primarykey
    data
    text
    <p>I have a simple interface:</p> <pre><code>public interface IVisitorsLogController { List&lt;VisitorsLog&gt; GetVisitorsLog(); int GetUniqueSubscribersCount(); int GetVisitorsCount(); string GetVisitorsSummary(); } </code></pre> <p>the class VisitorsLogController implements this interface.</p> <p>From a console application or a TestFixture - no problem - the console/test fixture compile perfectly.</p> <p>However, from an Asp.Net web site (not application) in the same solution with this code in the code behind</p> <pre><code>private IVisitorsLogController ctl; protected int GetUniqueMembersCount() { ctl = new VisitorsLogController(); return ctl.GetUniqueSubscribersCount(); } </code></pre> <p>the compiler throws this exception:</p> <blockquote> <p>Error 1 'WebSiteBusinessRules.Interfaces.IVisitorsLogController' does not contain a definition for 'GetUniqueSubscribersCount' and no extension method 'GetUniqueSubscribersCount' accepting a first argument of type 'WebSiteBusinessRules.Interfaces.IVisitorsLogController' could be found (are you missing a using directive or an assembly reference?)</p> </blockquote> <p>yet for this code in the same file:</p> <pre><code> protected static int GetVisitorsCount() { return VisitorsLogController.Instance.GetVisitorsCount(DateTime.Today); } </code></pre> <p>the compiler compiles these lines without complaining. In fact if I add anything new to the Interface the compiler now complains when trying to compile the asp.net page.</p> <p>It can't be a missing using directive or assembly reference otherwise both methods would fail.</p> <p>This is driving me nuts!</p> <p>Any thoughts please?</p> <p>Thanks,</p> <p>Jeremy</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload