3
votes

I am using the WF4 designer to build a custom activity.

Whenever I try to assign a multi line statement to the 'Value' property in an Assign activity within the designer and rebuild my project the designer is broken with the error: "XC1020: Build error occurred in the XAML MSBuild task: ''xml:space' is a duplicate attribute name."

For example the following statement (no line breaks) is valid:

New WorkItem() With {.AssociatedProgrammeId = associatedProgrammeId, .AssociatedQuestionnaireId = associatedQuestionnaireId, .AssociatedQuestionnaireInstanceId = associatedQuestionnaireInstanceId, .DelayUntil = delayUntil}

but this statement breaks the designer (after building the project):

New WorkItem() With
{
    .AssociatedProgrammeId = associatedProgrammeId,
    .AssociatedQuestionnaireId = associatedQuestionnaireId,
    .AssociatedQuestionnaireInstanceId = associatedQuestionnaireInstanceId,
    .DelayUntil = delayUntil
}

The 2nd statement produces the following XAML:

<Assign.Value>
    <InArgument x:TypeArguments="local:WorkItem" xml:space="preserve">[New WorkItem() With
{
    .AssociatedProgrammeId = associatedProgrammeId,
    .AssociatedQuestionnaireId = associatedQuestionnaireId,
    .AssociatedQuestionnaireInstanceId = associatedQuestionnaireInstanceId,
    .DelayUntil = delayUntil
}]</InArgument>

Removing xml:space="preserve" and rebuilding fixes the designer so the the Activity can be edited but removes the line breaks from the InArgument.

I am assuming that I should be able to add a multine statement to the argument for the activity. I guess I could be worng and this is a limitation of the designer?

If not could someone please help me figure out how I can make Visual Studio behave?

1
looks like a bug, have you filed it on connect.microsoft.com/wf ? - Tim Lovell-Smith
Thanks for the suggestion Tim and sorry for the late reply. Just revisited the issue and the problem seems to have disappeared. - Ross

1 Answers

0
votes

Having revisited the problem. The issue seems to have resolved itself. I have not updated Visual Studio or anything like that so if anyone has similar problems I would suggest trying to restart Visual Studio.

Update The problem reappeared after a full rebuild of my project so I have submitted the problem as a bug on Microsoft Connect.

https://connect.microsoft.com/wf/feedback/details/685092/wf4-assignactivity-multi-line-statement-breaks-designer