Locally suppress warning in `SerializationReader`

`SerializationReader` is not written in a form that would support
turning nullability checking on for the entire class. The biggest
problem there is the inner `DynamicDeserializer` static class, whose
members are initialised via an `initialize()` method, which the compiler
knows nothing about.

For this reason, just opt to suppress the single inspection about
returning a `null` from a method with a return type of `string` (rider
expects `string?`). It would have been also viable to enable nullability
checking for this one method, but that's pretty much the same thing and
adds no safety anyways, so just disable the warning to minimise
surprise.
This commit is contained in:
Bartłomiej Dach 2021-05-14 23:29:34 +02:00
parent b36c991ba1
commit 044770f1a2
1 changed files with 1 additions and 0 deletions

View File

@ -38,6 +38,7 @@ public static SerializationReader GetReader(SerializationInfo info)
/// <summary> Reads a string from the buffer. Overrides the base implementation so it can cope with nulls. </summary>
public override string ReadString()
{
// ReSharper disable once AssignNullToNotNullAttribute
if (ReadByte() == 0) return null;
return base.ReadString();