Visual Studio Project Adding Connected Services using Generic List Fails

1.1k Views Asked by At

In an ASP.NET Core 3.1 website project I use connected services for legacy WFC. In VS I choose Add -> Connected Service. When adding the service I set the CollectionMappings to Generic.List so that the proxy creates List<T> types instead of arrays.

Today I went to update the connected service, which I normally do by deleting it first and then re-creating it (there is no edit/update option). However, things have changed. Add -> Connected Service is gone - replaced with Manage Connected Services.

But now when adding the service - despite choosing "Generic.List", the proxy generates arrays. Which results in a thousand lines of my code now underlined in red.

I searched the Net for this issue and found some references from 2010 and a few years ago but I couldn't find any solutions.

The generated classes still have [System.Runtime.Serialization.DataContractAttribute... so I don't think it's using XmlSerializer - which apparently doesn't honor the Collection Mapping settings.

I also noticed that the Svcutil version has changed. It used to be 2.0.2 and is now 2.0.3

[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]

[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]

The only work-around I can think of for now is to manually update the Reference.cs file and make the following find/replace changes:

System.Threading.Tasks.Task<T[]>

...to:

Task<System.Collections.Generic.List<T>

Anyone have experience with this? It appears to be a bug in the Svcutil update (note the preview3.21351.2). And if Collection Mappings are no longer supported why are they still showing in the dialog?

0

There are 0 best solutions below