Avoid NullReferenceException in BinaryObjectInfo (dotnet/corefx#35740)
authorStephen Toub <stoub@microsoft.com>
Mon, 4 Mar 2019 00:22:23 +0000 (19:22 -0500)
committerDan Moseley <danmose@microsoft.com>
Mon, 4 Mar 2019 00:22:23 +0000 (16:22 -0800)
commit816802e154b90200b6a392ad75d3a0dfc4fdeeee
treece9ca30ad6113d063fc5d41123df8490288f2b71
parentf8a8530d0fab6b08254215ef2567f98de14db709
Avoid NullReferenceException in BinaryObjectInfo (dotnet/corefx#35740)

A corrupted BinaryFormatter stream can result in a BinaryObjectInfo getting constructed before the ObjectManager is constructed, resulting in the BinaryObjectInfo not having a reference to the ObjectManager.  Attempts to use it then hit a null reference exception.

Commit migrated from https://github.com/dotnet/corefx/commit/7622efd2dbd363a632e00b6b95be4d990ea125de
src/libraries/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryObjectInfo.cs