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 | * 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("Invoke", typeof(EventHandler<MyEventArgs | public static DependencyProperty InvokeEvent = DependencyProperty.Register("Invoke", typeof(EventHandler<MyEventArgs>), typeof(Activity1)); | ||
public event EventHandler<MyEventArgs | public event EventHandler<MyEventArgs> Invoke | ||
{ | { | ||
add | add |
Latest revision as of 09:25, 21 July 2020
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:
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
- 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.
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 { } }
- Switch to Design view for the workflow, and then add Activity1 to the workflow designer.
- In the workflow, right-click Activity1, and then click Properties.
- In the Properties dialog box, type
MethodName
in the Invoke box, and then press ENTER. - Switch to Design view for the workflow.
- 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. - Click Build, and then click Build Solution.
The Windows Workflow Foundation project builds successfully.
Keywords: kbtshoot kbprb KB927125