From a4cd6152b674aabcfecf392ff3e1bcb580b7163b Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 19 Feb 2019 13:01:13 -0800 Subject: [PATCH] Make JSRuntime.Current non-public (dotnet/extensions#1118) Fixes https://github.com/aspnet/AspNetCore/issues/6828\n\nCommit migrated from https://github.com/dotnet/extensions/commit/c1d8be8b980de62a299958e1816f06a81fea07bb --- .../ref/Microsoft.JSInterop.netstandard2.0.cs | 1 - src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/JSInterop/Microsoft.JSInterop/ref/Microsoft.JSInterop.netstandard2.0.cs b/src/JSInterop/Microsoft.JSInterop/ref/Microsoft.JSInterop.netstandard2.0.cs index 02146c7bab..95b9b7956c 100644 --- a/src/JSInterop/Microsoft.JSInterop/ref/Microsoft.JSInterop.netstandard2.0.cs +++ b/src/JSInterop/Microsoft.JSInterop/ref/Microsoft.JSInterop.netstandard2.0.cs @@ -52,7 +52,6 @@ namespace Microsoft.JSInterop } public static partial class JSRuntime { - public static Microsoft.JSInterop.IJSRuntime Current { get { throw null; } } public static void SetCurrentJSRuntime(Microsoft.JSInterop.IJSRuntime instance) { } } public abstract partial class JSRuntimeBase : Microsoft.JSInterop.IJSRuntime diff --git a/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs b/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs index 5a9830fa35..ae097ca68e 100644 --- a/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs +++ b/src/JSInterop/Microsoft.JSInterop/src/JSRuntime.cs @@ -11,13 +11,9 @@ namespace Microsoft.JSInterop /// public static class JSRuntime { - private static AsyncLocal _currentJSRuntime - = new AsyncLocal(); + private static readonly AsyncLocal _currentJSRuntime = new AsyncLocal(); - /// - /// Gets the current , if any. - /// - public static IJSRuntime Current => _currentJSRuntime.Value; + internal static IJSRuntime Current => _currentJSRuntime.Value; /// /// Sets the current JS runtime to the supplied instance.