I have a VS 2010 solution containing a WCF Library project and another project consuming that web service. After opening in VS 2012, it was upgraded.
The proxy now returns List<T> types as arrays, even though CollectionMappings is clearly set to Generic.List.
What could be happening?
Someone else has a similar problem here but he was downgrading from VS 2012 to VS 2010 instead.
Edit: I double checked, and Reference.svcmap contains:
<CollectionMappings>
<CollectionMapping TypeName="System.Collections.Generic.List`1" Category="List" />
</CollectionMappings>
but Reference.cs contains stuff such as:
public xxx.ServiceReference1.ADUser[] get_ADUsers;
when in the web service it is:
public List<ADUser> get_ADUsers(string wildcard, string sortexp, string sortorder)
More info (added Dec 12, 2012):
The solution, created in VS2010, was working fine on another PC. It was checked into TFS from that PC. On this problematic PC, we did a mapping and GET. When we try to build, we got that error where all the List<T> types used in the service reference were all somehow treated as arrays. We installed VS 2010 on the problematic PC and GET that solution too. And the same error is also there. So, it appears it is not related to VS 2012.
All PCs are Windows 7 Professional.
More info (added Dec 19, 2012):
When the project was opened, ServiceReferences/ServiceReference1/Reference.cs on the local PC was modified automatically. The changes were huge. Below is a small part of it:
Two methods are shown. List<string> get_Hotlines() become string[] get_Hotlines() and List<string> get_HotlinesBySite() becomes string[] get_HotlinesBySite().
Why is the file changed even without my asking? The VS 2012 upgrade log said two files were changed but Reference.cs wasn't one of them.
When you add reference to wcf service you need to change Collection Type to Generic List:
You can also update this settings just select service reference inside your solution, make right mouse click and select "Configure Service Reference..."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With