DNEX

I modify some existing projects using WCF. Some of classes derive from ArrayList and serializable. When I try to pass these objects in callback event, I have InvalidDataContractException because of missing default constructor in those classes. After I add default constructors for them, I get InnerException with error message containing ArrayofAnyType. Then I add Add method again for those classes. Now I get timeout exception.

I try to meet Advanced collection rules found in MSDN. In addition to default constructors and Add method, what else I can do Since those collection (ArrayList) have different types of objects, I am wondering it maybe the service do NOT know how to deserialize them. Is there any special things I can do when I create client proxy file

Some of existing codes were written using .NET 1.0, the ArrayList of objects are not type safe (many casting). It will the last resort to modify those collection type safe because of work load.

Another question, When I create the client proxy, the existing serializable classes keep the same namespace as the existing ones. Compiling fails due to some definition conflicts. I have to modify some proxy namespaces to my contract's namespace to pass the compiler. Anyone know how to avoid this problem when using svcutil.exe.

Any sugguestion will be much appreciated.



Re: Windows Communication Foundation (Indigo) How to handle data collection (ArrayList)?

Carlos Figueira - MSFT

For the first question, can you send an example of the List class you're using and having problem with

For the second question, if you're going to have the client and the server at the same assembly, you don't need to use the classes generated by svcutil, you can simply use the original ones.





Re: Windows Communication Foundation (Indigo) How to handle data collection (ArrayList)?

Dwight Goins

Here's a link to help out:

http://msdn2.microsoft.com/en-us/library/aa347850.aspx






Re: Windows Communication Foundation (Indigo) How to handle data collection (ArrayList)?

DNEX

I read this article before I posted the question.

I figure out the problem is due to the ArrayLists in my class, which are casted in usage. The WCF serialization may get confused. After I change them to be Generic List, it seems working now.





Re: Windows Communication Foundation (Indigo) How to handle data collection (ArrayList)?

DNEX

The ArrayList element contents are set to the default values when they are trasmitted to client side. Those ArrayList are in a class marked as [Serializable]. Do you have any idea I have created sample projects, but I could find a way to attach the zipped file in this forum. Thanks.