ArgumentNullException not thrown from delegate serialization if 'info' is null
Calling GetObjectData() on delegates with a null 'info' parameter should throw an ArgumentNullException, not a NullReferenceException.
MSDN documentation: https://msdn.microsoft.com/en-us/library/system.multicastdelegate.getobjectdata(v=vs.110).aspx
This code should be added to MulticastDelegate.GetObjectData:
if (info == null)
throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
I just tried this in desktop and it seems to throwing System.NullReferenceException same as .net core. I believe this will be a breaking change for desktop if we decide to change it for desktop. And looking at mono code I believe it will also throw NullReferenceException. For net core we should be maintain the same behavior. So I do not intend to make any change here.
The NullReferenceException is incorrect. On ProjectN/CoreRT, we are throwing the correct exception and we should fix the Desktop/netcore to achieve the correct documented behavior. This is an acceptable breaking change.
This will not be fixed in desktop and it is not worth fixing this for net core if we are not fixing for desktop. @fadimounir are you ok with closing this issue?
ok