stop using RuntimeInformation.IsOSPlatform(OSPlatform.Browser) (removed in upcoming builds) (#24652)

switch back to RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"))
This commit is contained in:
Adam Sitnik 2020-08-07 21:10:02 +02:00 committed by GitHub
parent 6020fdef0b
commit a196a6a0db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Components
static PlatformInfo() static PlatformInfo()
{ {
IsWebAssembly = RuntimeInformation.IsOSPlatform(OSPlatform.Browser); IsWebAssembly = RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"));
} }
} }
} }

View File

@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Components.Web.Extensions
protected ProtectedBrowserStorage(string storeName, IJSRuntime jsRuntime, IDataProtectionProvider dataProtectionProvider) protected ProtectedBrowserStorage(string storeName, IJSRuntime jsRuntime, IDataProtectionProvider dataProtectionProvider)
{ {
// Performing data protection on the client would give users a false sense of security, so we'll prevent this. // Performing data protection on the client would give users a false sense of security, so we'll prevent this.
if (RuntimeInformation.IsOSPlatform(OSPlatform.Browser)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")))
{ {
throw new PlatformNotSupportedException($"{GetType()} cannot be used when running in a browser."); throw new PlatformNotSupportedException($"{GetType()} cannot be used when running in a browser.");
} }

View File

@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Services
/// <returns>A list of the loaded <see cref="Assembly"/></returns> /// <returns>A list of the loaded <see cref="Assembly"/></returns>
public async Task<IEnumerable<Assembly>> LoadAssembliesAsync(IEnumerable<string> assembliesToLoad) public async Task<IEnumerable<Assembly>> LoadAssembliesAsync(IEnumerable<string> assembliesToLoad)
{ {
if (RuntimeInformation.IsOSPlatform(OSPlatform.Browser)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER")))
{ {
return await LoadAssembliesInClientAsync(assembliesToLoad); return await LoadAssembliesInClientAsync(assembliesToLoad);
} }