Microsoft KB Archive/927125

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

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 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 ' ' 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 &quot;Applies to&quot; section.



Steps to reproduce the problem
 On a computer that has Microsoft Visual Studio 2005 Extensions for Windows Workflow Foundation installed, start Microsoft Visual Studio 2005. Click File, click New, and then click Project. Under the Visual C# node, click Workflow. Click Sequential Workflow Console Application, type Q927125 in the Name box, and then click OK. In Solution Explorer, right-click Q927125, click Add, and then click Activity. In the Add New Item dialog box, click Activity, type Activity1, and then click Add.</li>  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(&quot;Invoke&quot;, 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 {   }

} </li> Switch to Design view for the workflow, and then add Activity1 to the workflow designer.</li> In the workflow, right-click Activity1, and then click Properties.</li> In the Properties dialog box, type in the Invoke box, and then press ENTER.</li> Switch to Design view for the workflow.</li> 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.</li> Click Build, and then click Build Solution.

The Windows Workflow Foundation project builds successfully.</li></ol>

Keywords: kbtshoot kbprb KB927125

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.