Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4249872
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:27:14+00:00 2026-05-21T04:27:14+00:00

I got this weird problem where System.Action cant be resolved when its not explicitly

  • 0

I got this weird problem where System.Action cant be resolved when its not explicitly defined above. To explain this in a better way i show you the code

    [TestMethod]
    public void Channel_Dispatch_Waits_Before_Return()
    {
        //Action useless = null;

        WorkflowChannel channel = new WorkflowChannel();
        bool isHandeled = false;

        channel.Subscribe(WorkflowHandlerFactory.FromLambdaAsync<int>((data, callback, onError) =>
        {
            // Go on another thread and sleep for a small ammount of time to simulate a async request
            System.Threading.ThreadPool.QueueUserWorkItem(state =>
            {
                System.Threading.Thread.Sleep(100);

                isHandeled = true;

                callback();
            });
        }));


        channel.Dispatch(1);

        Assert.IsTrue(isHandeled);
    }

This gives a compile time error, namely:

Error 1 Delegate ‘Action’ does not take 0 arguments C:\Users***\Documents\Visual Studio 2010\Projects\MessageWorkflow\MessageWorkfow.Test\WorkflowChannelTest.cs 47 21 MessageWorkflow.Test

However, when i uncomment the line:

Action useless = null;

It doesnt give a compile time error. I tried to rebuild etc but no use.
If required, the declaration of: FromLambdaAsync is:

public static IWorkflowHandler FromLambdaAsync<T>(AsyncAction<T> method)

Where AsyncAction is:

public delegate void AsyncAction<T>(T message, Action onComplete, Action<Exception> onError);

Its not a showstopper but i’m confused since i cant find any logic behind this… Who can slap me in the face?

Cheers!

* EDIT *

I managed to reproduce this behavior in the most simple test case, see:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClassLibrary2
{
    public delegate void AsyncAction(Action onComplete);

    public class WorkflowHandler
    {

    }

    public class Main
    {
        public static WorkflowHandler FromLambdaAsync(AsyncAction method)
        {
            return new WorkflowHandler();
        }
    }
}

With the unit test:

using ClassLibrary2;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace TestProject1
{
    [TestClass]
    public class MainTest
    {
        [TestMethod()]
        public void FromLambdaAsyncTest()
        {
            Main.FromLambdaAsync((callback) =>
                {
                    callback();
                });
        }
    }
}

Which gives me the same error

The project is compiling against .NET 4.0 usign VS 2010 sp1

* EDIT 2: *

Simplified the test case even more, no change in the result

* EDIT 3 *

Even in the most simple test case this fails, see:

[TestMethod()]
public void FromLambdaAsyncTest()
{
    AsyncAction action = c => c();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:27:15+00:00Added an answer on May 21, 2026 at 4:27 am

    Duplicated: see 'Delegate 'System.Action' does not take 0 arguments.' Is this a C# compiler bug (lambdas + two projects)?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got a weird problem with CodeIgniter's URI segment system. When I have this
I hit this weird problem when implementing ABPeoplePickerNavigationControllerDelegate. So identifier sometime was got its
I've got a weird problem where if i do something like this in a
Got this line of code here but its not working. private void Button_Click(object sender,
I'm trying to build a Debian package, but I've got this weird pseudo-directory problem.
I got this very weird problem...and it's very important to my...dead line is close...and
I have been puzzled by this weird problem and it got me stuck. Please
This is really weird problem. I just installed Node.JS on my system (Fedora). I
Ok, this is a weird problem, so please bear with me as I explain.
I've got this weird problem - I'm calling ChangeServiceConfig on a newly installed service

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.