Microsoft KB Archive/927125: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "<" to "<")
m (Text replacement - ">" to ">")
 
Line 41: Line 41:
Consider the following scenario:
Consider the following scenario:
* You create a Microsoft Windows Workflow Foundation project.
* You create a Microsoft Windows Workflow Foundation project.
* You create a custom activity that contains a dependency property of the '''EventHandler<MyArgs&gt;''' type.
* You create a custom activity that contains a dependency property of the '''EventHandler<MyArgs>''' type.
* You add the custom activity to the workflow designer, and then you assign a handler to the custom activity.
* You add the custom activity to the workflow designer, and then you assign a handler to the custom activity.


Line 102: Line 102:
             InitializeComponent();
             InitializeComponent();
         }
         }
         public static DependencyProperty InvokeEvent = DependencyProperty.Register(&quot;Invoke&quot;, typeof(EventHandler<MyEventArgs&gt;), typeof(Activity1));
         public static DependencyProperty InvokeEvent = DependencyProperty.Register(&quot;Invoke&quot;, typeof(EventHandler<MyEventArgs>), typeof(Activity1));
         public event EventHandler<MyEventArgs&gt; Invoke
         public event EventHandler<MyEventArgs> Invoke
         {
         {
             add
             add

Latest revision as of 09:25, 21 July 2020

Knowledge Base


Error message when you create a custom activity that contains a dependency property in Windows Workflow Foundation: "Method 'MethodName' could not be resolved"

Article ID: 927125

Article Last Modified on 3/2/2007



APPLIES TO

  • Windows Workflow Foundation



SYMPTOMS

Consider the following scenario:

  • You create a Microsoft Windows Workflow Foundation project.
  • You create a custom activity that contains a dependency property of the EventHandler<MyArgs> type.
  • You add the custom activity to the workflow designer, and then you assign a handler to the custom activity.

In this scenario, you may receive an error message that resembles the following in the workflow designer:

Method 'MethodName' could not be resolved. Either method could not be found or method signature does not match the delegate type.

However, if you build the Windows Workflow Foundation project, the Windows Workflow Foundation project builds successfully.

WORKAROUND

You can safely ignore this error message. The Windows Workflow Foundation project builds successfully.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

  1. On a computer that has Microsoft Visual Studio 2005 Extensions for Windows Workflow Foundation installed, start Microsoft Visual Studio 2005.
  2. Click File, click New, and then click Project.
  3. Under the Visual C# node, click Workflow.
  4. Click Sequential Workflow Console Application, type Q927125 in the Name box, and then click OK.
  5. In Solution Explorer, right-click Q927125, click Add, and then click Activity.
  6. In the Add New Item dialog box, click Activity, type Activity1, and then click Add.
  7. In the Activity1.cs code file, replace the existing code by using the following code.

    using System;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Collections;
    using System.Drawing;
    using System.Workflow.ComponentModel;
    using System.Workflow.ComponentModel.Design;
    using System.Workflow.ComponentModel.Compiler;
    using System.Workflow.ComponentModel.Serialization;
    using System.Workflow.Runtime;
    using System.Workflow.Activities;
    using System.Workflow.Activities.Rules;
    
    namespace Q927125
    {
        public partial class Activity1: SequenceActivity
        {
            public Activity1()
            {
                InitializeComponent();
            }
            public static DependencyProperty InvokeEvent = DependencyProperty.Register("Invoke", typeof(EventHandler<MyEventArgs>), typeof(Activity1));
            public event EventHandler<MyEventArgs> Invoke
            {
                add
                {
                    base.AddHandler(Activity1.InvokeEvent, value);
                }
                remove
                {
                    base.RemoveHandler(Activity1.InvokeEvent, value);
                }
            }
    
        }
        public class MyEventArgs : EventArgs
        {
        }
    
    }
  8. Switch to Design view for the workflow, and then add Activity1 to the workflow designer.
  9. In the workflow, right-click Activity1, and then click Properties.
  10. In the Properties dialog box, type MethodName in the Invoke box, and then press ENTER.
  11. Switch to Design view for the workflow.
  12. In the upper-right corner of Activity1 in the workflow, click the arrow that is next to the smart tag.

    The error message is displayed.

    Note The error message may also be displayed in the Error List window.
  13. Click Build, and then click Build Solution.

    The Windows Workflow Foundation project builds successfully.


Keywords: kbtshoot kbprb KB927125