Skip to content

Commit d3539ef

Browse files
authored
DOCSP-44196 - NaN/Infinity serialization exception (#251)
1 parent 543e9c2 commit d3539ef

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

source/fundamentals/serialization/poco.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ attributes change the way that the driver serializes each property of
8787
your POCO. This section describes some of the common
8888
serialization-related attributes.
8989

90-
9190
Serialize Read-Only Properties
9291
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9392

@@ -195,6 +194,12 @@ For more information on valid type conversions, see the `{+language+}
195194
Conversions Specification
196195
<https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/conversions>`__.
197196

197+
.. important:: Serializing NaN and Infinity
198+
199+
If you try to serialize or deserialize a floating-point
200+
``Infinity`` or ``NaN`` value to an integral representation, the driver throws an
201+
``OverflowException``.
202+
198203
Set Field Order
199204
~~~~~~~~~~~~~~~
200205

source/upgrade/v3.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,12 @@ Version 3.0 Breaking Changes
144144

145145
- The ``MongoClient`` constructor accepts only one ``Credential`` object instead of an
146146
array.
147+
148+
- If you try to serialize or deserialize a floating-point
149+
``Infinity`` or ``NaN`` value to an integral representation, the driver throws an
150+
``OverflowException``. To learn more about floating-point ``Infinity`` and ``NaN``
151+
values, see
152+
`Double.NaN, <https://learn.microsoft.com/en-us/dotnet/api/system.double.nan?view=net-8.0#system-double-nan>`__
153+
`Double.PositiveInfinity, <https://learn.microsoft.com/en-us/dotnet/api/system.double.positiveinfinity?view=net-8.0#system-double-positiveinfinity>`__
154+
and `Double.NegativeInfinity. <https://learn.microsoft.com/en-us/dotnet/api/system.double.negativeinfinity?view=net-8.0#system-double-negativeinfinity>`__
155+
on MSDN.

0 commit comments

Comments
 (0)