views:

92

answers:

1

Stackoverflow is definetly the fastest forum so after posting this question in the WCF forum I decided to come here.

I have a wcf service which returns a dictionary (IDictionary) and that works just fine. Now I wanted to add the capability of calling that service in async mode, but when the BeginMethod gets executed I get the following Exception:

The type System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[TransferProp, Contracts, Version=10.1.0.0, Culture=neutral, PublicKeyToken=6f5bf81c27b6b8aa]] is not supported because it implements IDictionary.

What's up with that?

A: 

This (CodeIdol) blog talks about deriving your own CollectionDataContract collection and returning this. Does this help?

[CollectionDataContract]
public class MyDictionary : Dictionary<int,Contact>
{}

[ServiceContract]
interface IContactManager
{
   ...
   [OperationContract]
   MyDictionary GetContacts( );
}
Preet Sangha
Nice... will check that and I'll come back to you... thanks
sebastian
it did not help, but that's the way one is suppose to do it, so I mark as answered. Found the same resolution from many resources, don't know what my problrm is :(
sebastian