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 8228979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:38:35+00:00 2026-06-07T16:38:35+00:00

I am working on a WPF application in VS2008 and decided to reuse some

  • 0

I am working on a WPF application in VS2008 and decided to reuse some code from another WPF application. However I have a strange issue with the following line:

Message.Dispatcher.Invoke(() => { Message.Text = "Looking for orders..."; });

This code works fine in the original application but throws the normal “Cannot convert lambda expression to type ‘System.Delegate’ because it is not a delegate type” error in the new application.

I know I can cast the expression as an Action to get it to work; but I am curious as to why the same piece of code compiles and works in one project but not another.

  • 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-06-07T16:38:36+00:00Added an answer on June 7, 2026 at 4:38 pm

    There might be an extension method defined somewhere in the old project that handles the casting!

    Something like:

    public static void Invoke(this Dispatcher dispatcher, Action action)
    {
        dispatcher.Invoke((Delegate)action);
    }
    

    Then you could just do the following without trouble:

    Message.Dispatcher.Invoke(() => { Message.Text = "Looking for orders..."; });
    

    Update:
    Turns out the .NET Framework has a set of extension methods for Dispatcher that can handle these kind of things build in already.

    http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcherextensions.aspx

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

Sidebar

Related Questions

I am working in C# and VS2008. I have a WPF application containing a
I'm recently working on a WPF application that uses the datagrid from the WPF
I'm building a WPF application and working with the MVVM pattern. I have 4
I was working with a WPF application and I decided that the controls and
I’m working on WPF based application. Environment is VS2008 SP1 with .NET 3.5 SP
I have a working WPF application. I would like to see it running as
I am working on WPF application. I have a window which has Combobox and
I am working on WPF application, and now I have to choose which database
I have been working on a WPF Application that is essentially a WYSIWYG editor,
I am working on a wpf application. I am having one image, i have

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.