Add service reference fails with compilation error in WF 4.5/4.5.1 projects


Statement

======================

WF application consumes WCF service.

WCF service is supposed to return List<CustomClass> in response for one of its methods.

The client application adds service reference with advanced option as “System.Collections.Generic.List”.

In reference.cs, List< CustomClass> member is generated.

 

However, there is a build error:

Compiler error(s) encountered processing expression “”.

Reference required to assembly ‘System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ containing the implemented interface ‘System.Runtime.Serialization.IExtensibleDataObject’.

This problem happens if build framework is 4.5 or 4.5.1.

The same activities do not generate any error in 4.0 framework.

 

Observation

======================

This is workflow tooling issue (bug) in recent version of .net 4.5/4.5.1.

 

Work around

======================

1)

Once add service reference has been run, it generates a XAML under reference.svcmap.

2)

Go to the generated XAML file.

3)

Add the following line for Activity tag:

xmlns:srs=”clr-namespace:System.Runtime.Serialization;assembly=System.Runtime.Serialization,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″

4)

This particular update in Activity tag must be applied on all the proxy generated XAML files.

 

In my sample, it appears like:

Before

<Activity
mc:Ignorable=”sap2010 sads”
x:Class=”WorkflowConsoleApplication1.ServiceReference1.Activities.GetAllBooks”
this:GetAllBooks.EndpointConfigurationName=”BasicHttpBinding_IService1″

xmlns=”http://schemas.microsoft.com/netfx/2009/xaml/activities

xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006

xmlns:mva=”clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities”

xmlns:p=”http://tempuri.org/

xmlns:p1=”http://schemas.microsoft.com/netfx/2009/xaml/servicemodel

xmlns:sads=”http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger

xmlns:sap2010=”http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation

xmlns:sc=”clr-namespace:System.ComponentModel;assembly=System”

xmlns:scg=”clr-namespace:System.Collections.Generic;assembly=mscorlib”

xmlns:this=”clr-namespace:WorkflowConsoleApplication1.ServiceReference1.Activities”

xmlns:ws=”clr-namespace:WorkflowConsoleApplication1.ServiceReference1;assembly=WorkflowConsoleApplication1″

xmlns:ws1=”clr-namespace:WorkflowConsoleApplication1.ServiceReference1;assembly=WorkflowConsoleApplication1,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null”

xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml“>

  <x:Members>

 

After

<Activity
mc:Ignorable=”sap2010 sads”
x:Class=”WorkflowConsoleApplication1.ServiceReference1.Activities.GetAllBooks”
this:GetAllBooks.EndpointConfigurationName=”BasicHttpBinding_IService1″

xmlns=”http://schemas.microsoft.com/netfx/2009/xaml/activities

xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006

xmlns:mva=”clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities”

xmlns:p=”http://tempuri.org/

xmlns:p1=”http://schemas.microsoft.com/netfx/2009/xaml/servicemodel

xmlns:sads=”http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger

xmlns:sap2010=”http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation

xmlns:srs=”clr-namespace:System.Runtime.Serialization;assembly=System.Runtime.Serialization,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″

xmlns:sc=”clr-namespace:System.ComponentModel;assembly=System”

xmlns:scg=”clr-namespace:System.Collections.Generic;assembly=mscorlib”

xmlns:this=”clr-namespace:WorkflowConsoleApplication1.ServiceReference1.Activities”

xmlns:ws=”clr-namespace:WorkflowConsoleApplication1.ServiceReference1;assembly=WorkflowConsoleApplication1″

xmlns:ws1=”clr-namespace:WorkflowConsoleApplication1.ServiceReference1;assembly=WorkflowConsoleApplication1,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null”

xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml“>

  <x:Members>

 

Now, build the solution. This should fix the issue.

This problem persists in Visual studio 2012/ 2013.

This is taken up as an addressable bug and will be addressed in the latest version of visual studio release.

 

I hope this helps!

Comments (0)

Skip to main content