From: Stephen Toub Date: Thu, 18 Aug 2016 18:06:39 +0000 (-0400) Subject: Fix serialization of delegates without targets X-Git-Tag: accepted/tizen/base/20180629.140029~3804^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3871c8b73ef7f29c7b392ed4992781fa8634579c;p=platform%2Fupstream%2Fcoreclr.git Fix serialization of delegates without targets A null check is missing when FEATURE_REMOTING is not defined, resulting in an invalid cast exception when deserializing a delegate without a target (e.g. a delegate for a static method). --- diff --git a/src/mscorlib/src/System/DelegateSerializationHolder.cs b/src/mscorlib/src/System/DelegateSerializationHolder.cs index 6be712e..a628033 100644 --- a/src/mscorlib/src/System/DelegateSerializationHolder.cs +++ b/src/mscorlib/src/System/DelegateSerializationHolder.cs @@ -221,7 +221,7 @@ namespace System #if FEATURE_REMOTING Object target = de.target != null ? RemotingServices.CheckCast(de.target, targetType) : null; #else - if(!targetType.IsInstanceOfType(de.target)) + if(de.target != null && !targetType.IsInstanceOfType(de.target)) throw new InvalidCastException(); Object target=de.target; #endif