I have a LINQ model containing an entity which is populated by a stored procedure. A couple of the fields returned by the procedure are nullable bit fields, so I've created these as nullable booleans on the model. I'd expect this to work fine, but when I run my application I get the following exception from System.Runtime.Serialization
...
The formatter threw an exception while trying to deserialize the message: There was an error while try开发者_JS百科ing to deserialize parameter urn:Nbs.PrePaidCards.ChargebackService:GetUnlinkedChargebacksAndRepresentmentsResult. The InnerException message was 'ValueType 'System.Boolean' cannot be null.'. Please see InnerException for more details.
Now I'd understand this if I was trying to populate a regular bool
field with a null
, but since the property is Nullable
, this has me a bit stumped!
Had anyone else had this problem and know how to fix it?
Thanks
The problem was caused by an out of date service reference on my client, so whilst the service had a nullable bool field, the proxy on the client was still expecting a regular bool field, hence the serialization exception.
精彩评论