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

  • Home
  • SEARCH
  • 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 6929749
In Process

The Archive Base Latest Questions

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

Why is Visual Studio 2010 telling me ‘System.Delegate’ does not contain a definition for

  • 0

Why is Visual Studio 2010 telling me “‘System.Delegate’ does not contain a definition for ‘EndInvoke'” when I call job.Delegate.EndInvoke()? How do I fix it? Note that it likes BeginInvoke() just fine, and doesn’t complain if I add EndInvoke() immediately after BeginInvoke() (thought hat doesn’t accomplish what I want).

I have a little JobTracker class for tracking backup jobs:

public class JobTracker 
{
    private class Job
    {
        public Account Account { get; set; }
        public IAsyncResult Result { get; set; }
        public Delegate Delegate { get; set; }
        public bool IsCompleted { get { return result.IsCompleted } }
        public string Instance { get { return Account.Instance } }
    }

    public List<Job> Running = new List<Job>;

    public void AddJob(Account a, IAsyncResult result, Delegate del)
    {
        var j = new Job { Account = a, Result = result, Delegate = del };
        Running.Add(j);
    }

    public void RemoveJob(Job job)
    {
        Running.Remove(job);
    }

public bool IsInstanceRunning(string instance)
{
    return (Running.Count(x => x.Instance == instance) > 0);
}
}

These backup jobs will happen asynchronously via BeginInvoke()/EndInvoke(). The calling code (simplified) looks something like this:

public void BackupAccounts(IEnumerable<Account> accounts, int maxconcurrent = 4)
{
    // local copy
    List<Accounts> myaccounts = accounts.ToList();
    var jobs  = new JobTracker();

    while (myaccounts.Count > 0) 
    {
        // check our running jobs
        foreach (var job in jobs.Running)
        {
            if (job.IsCompleted)
            {
// PROBLEM LINE:
                job.Delegate.EndInvoke();
                jobs.RemoveJob(job);

            }
        }

        // more jobs!
        while (jobs.Count < maxconcurrent)
        {
            int i = 0;
            Account account = null;

            // choose the next account on a free instance
            while (int < accounts.Count)
            {
                account = accounts[i];
                // instance in use?
                if (jobs.InstanceIsRunning(account.Instance))
                {
                    i += 1;
                    continue;
                }
                else
                {
                    // start the job
                    accounts.RemoveAt(i);
                    BackupDelegate del = new BackupDelegate(BackupAccount, account);
                    IAsyncResult result = del.BeginInvoke();
                    jobs.AddJob(account, result, del);
                }
            }
        }

        // we're all full up, give it some time to work
        Thread.Sleep(2000);
    }
}

PS – I know this code can be greatly simplified. It’s a first, get-it-working iteration — I just can’t figure out why VS doesn’t like it.

  • 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-27T11:21:27+00:00Added an answer on May 27, 2026 at 11:21 am

    When you call BeginInvoke, you’re calling it on a specific subclass of Delegate. When you call EndInvoke, you’re trying to call it on System.Delegate itself, which won’t work. Each subclass declares its own Invoke/BeginInvoke/EndInvoke set of methods – which it has to, given that the signatures of the methods varies according to the signature of the exact delegate type you’re talking about. If you look at the documentation for System.Delegate you won’t find any of those methods there.

    It’s not really clear what your code is trying to achieve, but if you want to call EndInvoke, you’ll need to make Job.Delegate a specific delegate type.

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

Sidebar

Related Questions

Visual studio 2010 does not break at the break point in javascript, I use
With Visual Studio 2010 right around the corner, what does Visual Studio 2008 Professional
In Visual Studio 2010, sometimes within the same session (not having rebooted the app)
Does Visual Studio 2010 Beta support .NET 2.0 projects? What about opening SQL 2005
Visual Studio 2010 offers a lot of comfortable tools for unit testing via its
Visual Studio 2010 RC -> Silverlight Application We have a library of images that
Since Visual Studio 2010 is slated for release in March of 2010 and HTML
In Visual Studio 2010 Beta 2 I created a new navigation Silverlight application. Without
In Visual Studio 2010, when you say new Item, you can see Asp.NET Handler
Do visual studio 2010 include already Sql Server instance, or I need to install

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.