From 5114f2f1a25a712112b4e23e2dae99dfa9b91dac Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 23 Sep 2019 09:42:48 -0700 Subject: [PATCH] Add null check for DotNetObjectReference (dotnet/extensions#2372) \n\nCommit migrated from https://github.com/dotnet/extensions/commit/45776ac25c750bc98522f7d8bdbba61bcc7540d4 --- .../Microsoft.JSInterop/src/DotNetObjectReference.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/JSInterop/Microsoft.JSInterop/src/DotNetObjectReference.cs b/src/JSInterop/Microsoft.JSInterop/src/DotNetObjectReference.cs index 989d8062bb..53217936d6 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/DotNetObjectReference.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/DotNetObjectReference.cs @@ -1,6 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; + namespace Microsoft.JSInterop { /// @@ -15,6 +17,11 @@ namespace Microsoft.JSInterop /// An instance of . public static DotNetObjectReference Create(TValue value) where TValue : class { + if (value is null) + { + throw new ArgumentNullException(nameof(value)); + } + return new DotNetObjectReference(value); } }