Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Parser Bug on delegate?
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/4466859/delegate-system-action-does-not-take-0-arguments-is-this-a-c-compiler-bug">&#39;Delegate &#39;System.Action&#39; does not take 0 arguments.&#39; Is this a C# compiler bug (lambdas + two projects)?</a> </p> </blockquote> <p>When I was doing a testing framework that used heavy lambda usage I thing I stumbled on a parser bug.</p> <pre><code>public class CSpecTestRunnerSpec : CSpecFacade&lt;CSpecTestRunner&gt; { public CSpecTestRunnerSpec() : base(new CSpecTestRunner()) { CreateOperations(); } private MyClassSpec myClassSpec; private DescribeAll run_on_type; protected override void BeforeOperation() { myClassSpec = new MyClassSpec(); } private void CreateOperations() { run_on_type = (@it, @do) =&gt; { @it("Runs all of the operations contained in a type"); @do.RunTestOnType(myClassSpec.GetType()); }; } </code></pre> <p>DescribeAll delegate comes from the base class and it's interface looks like so:</p> <p>EDIT the code looks like so:</p> <pre><code>public delegate void DescribeAll(Action&lt;string&gt; description, TClass objSpec); </code></pre> <p>The exception I'm getting is "Delegate Action does not take 1 arguments" But it totally does! and after adding a dummy delegate to code of my class:</p> <pre><code> private Action&lt;string&gt; dummy; </code></pre> <p>It started to work. :-)</p> <p>By contrast the same code works without errors in mono without the dummy delegate it was tested on multiple machines with NET 3.5 and 4.0.</p> <p>So my question is, is this a bug on the compiler side or my side?, and how to resolve the issue?</p> <p>p.s the framework is on <a href="http://cspec.codeplex.com/" rel="nofollow noreferrer">codeplex</a> so you can get the full code and test it yourself.</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.
 

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