![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | DataContract with DateTime field gives error Hi all, I try to get my fingers around the Hands-On Labs for WCF. One of the samples uses the following DataContract: [DataContract(NameSpace="Fabrikam", Name="Trade")] public class Trade { [DataMember] public string Symbol; [DataMember] public long? Count; [DataMember] public DateTime? Date; } The Service contract has the following Operation: void AddTrade(Trade trade); While implementing the functionality and setting the ServiceBehaviour of the service implementation to (ReturnUnknownExceptionsAsFaults = true) results in the following error: System.ServiceModel.UnknownFaultException: The added or subtracted value results in an un-representable DateTime. Does anyone has an idea about the cause? I have the WinFX Jan CTP. Thanks in advanche, Iwan Bel |
My System Specs![]() |
| | #2 (permalink) |
| | Re: DataContract with DateTime field gives error Iwan, instead of "DateTime.Now" you should use : new DateTime( DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond); or more simply: new DateTime(DateTime.Now.Ticks); Adi a écrit : > I can't find the blog entry now, but there is a known bug with datetime in > Jan CTP (I suppose you enter "DateTime.Now" as value). > As far as I recall, you should try using UTC instead, or assign only a date > as a value. > > <iwan.bel@gmail.com> wrote in message > news:1141050026.529330.44100@i40g2000cwc.googlegroups.com... > >>Hi all, >> >>I try to get my fingers around the Hands-On Labs for WCF. >>One of the samples uses the following DataContract: >> >>[DataContract(NameSpace="Fabrikam", Name="Trade")] >>public class Trade >>{ >> [DataMember] >> public string Symbol; >> [DataMember] >> public long? Count; >> [DataMember] >> public DateTime? Date; >>} >> >>The Service contract has the following Operation: >> >>void AddTrade(Trade trade); >> >>While implementing the functionality and setting the ServiceBehaviour >>of the service implementation to (ReturnUnknownExceptionsAsFaults = >>true) results in the following error: >> >>System.ServiceModel.UnknownFaultException: The added or subtracted >>value results in an un-representable DateTime. >> >>Does anyone has an idea about the cause? >> >>I have the WinFX Jan CTP. >> >>Thanks in advanche, >>Iwan Bel >> > > > |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Error in Status Field of Printer | Vista print fax & scan | |||
| Re: error converting object to datetime array element from sql table | PowerShell | |||
| Rounding of a [datetime] | PowerShell | |||