Search
Closed
as Fixed Help for as Fixed

1
Sign in to vote
0
Sign in to vote
Sign in
to vote
Type: Bug
ID: 499506
Opened: 10/22/2009 9:36:16 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
I'm rehosting the Workflow Designer in .NET 4.0. In Beta 1, this worked fine, but in Beta 2 the View is displaying duplicates of anything added form the toolbox. My code is the sample from the VS2010 Training Kit, IntroToWF lab, Exercise 10. When I drag an item from the toolbox, it appears in the designer view twice. However, there is only a single instance of the Activity in memory - when I change properties on one of the items, it reflects in the original and the duplicate. When I view the serialized XAML with the WorkflowDesigner.Text property, it only shows a single instance of the activity. So I believe this is a bug in the View itself.

I've noticed this doesn't occur with the designer in Visual Studio 2010 Beta 2, so it seems to be a problem that only occurs with a rehosted designer.

***** This only occurs in .NET Framework 4.0 Beta 2, NOT in Beta 1. I can't select Beta 2 from the Product Version in this feedback form. *****

I've verified this occurs in Windows 7 (x86) and Windows Server Standard 2008 SP2 (x64).
Details (expand)

Product Version

.NET Framework 4.0 Beta1
Product Language
English

Operating System
Windows 7 (client)
Operating System Language
English

Architecture
x86

Priority
(1=blocking, 2=important, 3=nice to have)
2

Severity
(1=major functionality issue, 2=important functionality issue, 3=nice to have)
2

Steps to Reproduce
1. Install VS 2010 Beta 2. (This did not occur in VS 2010 Beta 1).
2. Follow the steps in VS 2010 Training Kit, Intro To WF Lab, Exercise 10: Hosted Designer.
3. Launch the hosted designer, and drag an activity from the toolbox to the Sequence in the designer view.
Actual Results
The designer shows the activity twice at this point. If you modify the properties of the activity, it will update the original and duplicate activity displayed in the view. This is because they are referencing the same object.

If you view the WorkflowDesigner.Text property, it will only show one instance of the activity, so this seems to be a problem with the View.
Expected Results
I expect the View from the WorkflowDesigner to only show the activity once.
Component Usage
(any information on your scenario that may help in investigating your issue)
 

How often does this happen?
Always Happens

Have you seen this problem in other versions?
No, this is new to the most recent version

File Attachments
1 attachments
HelloDesigner.zip
Sign in to post a comment.
Posted by Pastorius on 10/22/2009 at 11:04 AM
I've noticed that this occurs when I display the Window that is hosting the designer twice in the same process. The first time I display the Window it works as expected. The second time, the view has the strange behavior of showing duplicates. This makes me believe some static data is being updated in each instance of the view. The only static data updated in my code is within RegisterMetadata():

MetadataStore.AddAttributeTable(builder.CreateTable());

I made RegisterMetadata static and called it from my Window class's static initializer to ensure it was only called once. This didn't seem to have any effect, so I believe the WorkflowDesigner itself may have some static data that it is updating incorrectly.
Posted by Microsoft on 10/25/2009 at 8:29 PM
Thank you for your feedback, We are currently reviewing the issue you have submitted.
Posted by tilovell on 10/27/2009 at 2:54 PM
Hi Pastorius,

I couldn't understand from your bug report how you are showing and hiding the Window. If I create a window that just has a designer view, and shows and hides in response to button click from another window, I don't see any doubling effect.

Are you adding handlers for events, or doing some initialization steps more than once? If you have additional information to add, I'd appreciate it.

Thanks,
Tim
Posted by Pastorius on 10/30/2009 at 9:44 AM
Tim,

Try this: change the HelloDesigner.MainWindow from the lab to a UserControl (adjusting the XAML and code behind file). Then add another Window to the project, make is the StartupURI in App.xaml, and give it the following markup, which hosts two instances of the designer Window on two TabItems in a TabControl. Run the project. Everything you add on the first tab will probably show up as normal. Everything you add on the second tab gets duplicated. I can zip up the project and send to you if needed.

<Window x:Class="HelloDesigner.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:HelloDesigner"
        Title="Window1" Height="300" Width="300">
    <Grid>
        <TabControl>
            <TabItem Header="Workflow1">
                <local:MainWindow />
            </TabItem>
            <TabItem Header="Workflow2">
                <local:MainWindow />
            </TabItem>
        </TabControl>
    </Grid>
</Window>
Posted by Pastorius on 10/30/2009 at 9:50 AM
I went ahead and zipped and attached my slightly modified HelloDesigner project. Replace the HostedDesigner project under the VS2010 Training Kit with this project to see the problem. Here is the path to the whole solution from wherever you've unzipped the VS2010 Training Kit.

VS2010TrainingKit\Labs\IntroToWF\Source\Ex10-HostedDesigner\End\C#
Posted by tilovell on 11/2/2009 at 9:45 AM
Pastorius,
Thank you for the added repro information, I was able to reproduce the bug and have passed it on for triage.
Tim