![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | CommunicationException during deserialization I can't figure out why this throws an exception during deserialization: ============== [DataContract(Namespace = http://OrderEntry)] public class Order { private OrderTypeEnum orderType; [DataMember] public OrderTypeEnum OrderType { get { return orderType; } set { orderType = value; } } } [DataContract(Name = "OrderType", Namespace = http://OrderEntry)] public enum OrderTypeEnum { [EnumMember] Regular = 1, [EnumMember] Overnight = 5 } interface IOrderEntry { [OperationContract] List<Order> GetPreliminary(DateTime dateFrom, DateTime dateTo); } ======================== When method retuns WCF throws CommunicationException The problem here is in OrderTypeEnum member, without this member I get no exception (I tried KnowType, didn't help)... |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: CommunicationException during deserialization Just a thought, but you may wish to include a None = 0, or provide a [DefaultValue]; otherwise orderType will be 0, which can't be serialized as there is no matching value (they are serialized by name, not value). Marc |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: CommunicationException during deserialization That's exactly what it was! I really appreciate you help, I spent a couple of hours trying to figure it out, I narrowed it down to the enum, but did not see that the value was not set... Thank you Here is the question, though Why doesn't WCF throws a meaninful exception? CommunictionException? I understand from the stack trace that the problem was during deserialization, but why not just explain that default value is not set and deserialization failed? How I am supposed to find the problem? Tracing? This was really nasty. And this wasn't the first time. Here is another example: I added a method to the service contract, updated client, but forgot to update the server. Spent two hours trying to find out why I was getting "An unsecured or incorrecly secured fault was received other party". It was just a contract mismatch, and had nothing to do with WCF internal plumbing, aborting server app domain, etc. "An usecured or incorrecly secured fault..", go figure... "Marc Gravell" <marc.gravell@gmail.com> wrote in message news:%23gmgbAAiHHA.4064@TK2MSFTNGP02.phx.gbl... > Just a thought, but you may wish to include a None = 0, or provide a > [DefaultValue]; otherwise orderType will be 0, which can't be serialized > as there is no matching value (they are serialized by name, not value). > > Marc > |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: CommunicationException during deserialization Re setting the value: fresh eyes. In my experience, we all tend to blitz past the simple bits since they can't *possibly* be wrong ;-p I am still trying to train myself to start looking at the simple things. Re the unclear errors; yup, I feel some of that pain. Marc |
My System Specs![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| XML Deserialization Attribute vs. Element | Todd | .NET General | 2 | 02-28-2008 01:40 PM |