The problem with the LINQ model - cannot assign NULL to a Nullable Boolean!

I have a LINQ model containing an object that is populated with a stored procedure. Several fields returned by the procedure are bits with null values, so I created them as NULL Booleans on the model. I expect this to work fine, but when I run my application, I get the following exception from System.Runtime.Serialization ...

The formatter made an exception while trying to deserialize the message: an error occurred while trying to deserialize the Urn parameter: Nbs.PrePaidCards.ChargebackService: GetUnlinkedChargebacksAndRepresentmentsResult. The InnerException message was System.Boolean 'ValueType' cannot be zero. '. See InnerException for more information.

Now I would understand this if I tried to fill in the regular bool field with null , but since the Nullable property, it puzzled me a bit!

Has anyone else had this problem and know how to fix it?

thanks

+7
source share
1 answer

The problem was caused by an outdated service reference on my client, therefore, although the service had a null bool field, the proxy on the client was still expecting a regular bool field, hence the serialization exception.

+10
source

All Articles