Skip to content

[release/3.1] Update dependencies from 3 repositories #16685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 146 additions & 146 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

146 changes: 73 additions & 73 deletions eng/Versions.props

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ public enum FetchCredentialsOption
SameOrigin = 1,
Include = 2,
}
public partial class WebAssemblyHttpMessageHandler : System.Net.Http.HttpMessageHandler
public static partial class WebAssemblyHttpMessageHandlerOptions
{
public const string FetchArgs = "WebAssemblyHttpMessageHandler.FetchArgs";
public WebAssemblyHttpMessageHandler() { }
public static Microsoft.AspNetCore.Blazor.Http.FetchCredentialsOption DefaultCredentials { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
[System.Diagnostics.DebuggerStepThroughAttribute]
protected override System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; }
public static Microsoft.AspNetCore.Blazor.Http.FetchCredentialsOption DefaultCredentials { get { throw null; } set { } }
}
}
namespace Microsoft.AspNetCore.Blazor.Rendering
Expand Down
43 changes: 0 additions & 43 deletions src/Components/Blazor/Blazor/src/Hosting/WebAssemblyHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Net.Http;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Blazor.Http;
using Microsoft.AspNetCore.Blazor.Rendering;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.JSInterop;
Expand All @@ -30,16 +27,6 @@ public WebAssemblyHost(IServiceProvider services, IJSRuntime runtime)

public Task StartAsync(CancellationToken cancellationToken = default)
{
// We need to do this as early as possible, it eliminates a bunch of problems. Note that what we do
// is a bit fragile. If you see things breaking because JSRuntime.Current isn't set, then it's likely
// that something on the startup path went wrong.
//
// We want to the JSRuntime created here to be the 'ambient' runtime when JS calls back into .NET. When
// this happens in the browser it will be a direct call from Mono. We effectively needs to set the
// JSRuntime in the 'root' execution context which implies that we want to do as part of a direct
// call from Program.Main, and before any 'awaits'.
SetBrowserHttpMessageHandlerAsDefault();

return StartAsyncAwaited();
}

Expand Down Expand Up @@ -102,35 +89,5 @@ public void Dispose()
{
(Services as IDisposable)?.Dispose();
}

private static void SetBrowserHttpMessageHandlerAsDefault()
{
// Within the Mono WebAssembly BCL, this is a special private static field
// that can be assigned to override the default handler
const string getHttpMessageHandlerFieldName = "GetHttpMessageHandler";
var getHttpMessageHandlerField = typeof(HttpClient).GetField(
getHttpMessageHandlerFieldName,
BindingFlags.Static | BindingFlags.NonPublic);

// getHttpMessageHandlerField will be null in tests, but nonnull when actually
// running under Mono WebAssembly
if (getHttpMessageHandlerField != null)
{
// Just in case you're not actually using HttpClient, defer the construction
// of the WebAssemblyHttpMessageHandler
var handlerSingleton = new Lazy<HttpMessageHandler>(
() => new WebAssemblyHttpMessageHandler());
Func<HttpMessageHandler> handlerFactory = () => handlerSingleton.Value;
getHttpMessageHandlerField.SetValue(null, handlerFactory);
}
else
{
// We log a warning in case this ever happens at runtime (even though there's
// no obvious way it could be possible), but don't actually throw because that
// would break unit tests
Console.WriteLine("WARNING: Could not set default HttpMessageHandler because " +
$"'{getHttpMessageHandlerFieldName}' was not found on '{typeof(HttpClient).FullName}'.");
}
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// 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;
using System.Reflection;

namespace Microsoft.AspNetCore.Blazor.Http
{
/// <summary>
/// Configures options for the WebAssembly HTTP message handler.
/// </summary>
public static class WebAssemblyHttpMessageHandlerOptions
{
/// <summary>
/// Gets or sets the default value of the 'credentials' option on outbound HTTP requests.
/// Defaults to <see cref="FetchCredentialsOption.SameOrigin"/>.
/// </summary>
public static FetchCredentialsOption DefaultCredentials
{
get
{
var valueString = MonoDefaultCredentialsGetter.Value();
var result = default(FetchCredentialsOption);
if (valueString != null)
{
Enum.TryParse(valueString, out result);
}
return result;
}

set
{
MonoDefaultCredentialsSetter.Value(value.ToString());
}
}

static Func<Type> MonoWasmHttpMessageHandlerType = ()
=> Assembly.Load("WebAssembly.Net.Http")
.GetType("WebAssembly.Net.Http.HttpClient.WasmHttpMessageHandler");

static Func<Type> MonoFetchCredentialsOptionType = ()
=> Assembly.Load("WebAssembly.Net.Http")
.GetType("WebAssembly.Net.Http.HttpClient.FetchCredentialsOption");

static Lazy<PropertyInfo> MonoDefaultCredentialsProperty = new Lazy<PropertyInfo>(
() => MonoWasmHttpMessageHandlerType()?.GetProperty("DefaultCredentials", BindingFlags.Public | BindingFlags.Static));

static Lazy<Func<string>> MonoDefaultCredentialsGetter = new Lazy<Func<string>>(() =>
{
return () => MonoDefaultCredentialsProperty.Value?.GetValue(null).ToString();
});

static Lazy<Action<string>> MonoDefaultCredentialsSetter = new Lazy<Action<string>>(() =>
{
var fetchCredentialsOptionsType = MonoFetchCredentialsOptionType();
return value => MonoDefaultCredentialsProperty.Value?.SetValue(null, Enum.Parse(fetchCredentialsOptionsType, value));
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@
4) Add the file we just created to the list of file writes, to support incremental builds.
-->
<ItemGroup>
<_MonoBaseClassLibraryFolder Include="$(MonoBaseClassLibraryPath);$(MonoBaseClassLibraryFacadesPath)" />
<_MonoBaseClassLibraryFolder Include="$(MonoBaseClassLibraryPath);$(MonoBaseClassLibraryFacadesPath);$(MonoWasmFrameworkPath)" />
<_BlazorAssembliesToLink Include="@(_BlazorDependencyInput->'-a &quot;%(Identity)&quot;')" />
<_BlazorAssembliesToLink Include="@(IntermediateAssembly->'-a &quot;%(FullPath)&quot;')" />
<_BlazorFolderLookupPaths Include="@(_MonoBaseClassLibraryFolder->'-d &quot;%(Identity)&quot;')" />
Expand Down Expand Up @@ -522,7 +522,7 @@

<PropertyGroup>
<_ReferencesArg Condition="'@(_BlazorDependencyInput)' != ''">--references &quot;$(BlazorResolveDependenciesFilePath)&quot;</_ReferencesArg>
<_BclParameter>--base-class-library &quot;$(MonoBaseClassLibraryPath)&quot; --base-class-library &quot;$(MonoBaseClassLibraryFacadesPath)&quot;</_BclParameter>
<_BclParameter>--base-class-library &quot;$(MonoBaseClassLibraryPath)&quot; --base-class-library &quot;$(MonoBaseClassLibraryFacadesPath)&quot; --base-class-library &quot;$(MonoWasmFrameworkPath)&quot;</_BclParameter>
</PropertyGroup>

<WriteLinesToFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@
<type fullname="System.ComponentModel.GuidConverter" />
<type fullname="System.ComponentModel.TimeSpanConverter" />
</assembly>

<assembly fullname="WebAssembly.Net.Http">
<!-- Without this, the setter for DefaultCredentials would be removed, but we need it -->
<type fullname="WebAssembly.Net.Http.HttpClient.FetchCredentialsOption" />
<type fullname="WebAssembly.Net.Http.HttpClient.WasmHttpMessageHandler" />
</assembly>
</linker>
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<ItemGroup>
<_BclDirectory Include="$(MonoBaseClassLibraryPath)" />
<_BclDirectory Include="$(MonoBaseClassLibraryFacadesPath)" />
<_BclDirectory Include="$(MonoWasmFrameworkPath)" />
</ItemGroup>

<WriteLinesToFile Lines="@(ReferencePath)" File="$(TargetDir)referenceHints.txt" WriteOnlyWhenDifferent="true" Overwrite="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ async Task GetScopeProperties (int msg_id, int scope_id, CancellationToken token
// Trying to inspect the stack frame for DotNetDispatcher::InvokeSynchronously
// results in a "Memory access out of bounds", causing 'values' to be null,
// so skip returning variable values in that case.
while (values != null && i < var_ids.Length && i < values.Length) {
while (values != null && i < vars.Length && i < values.Length) {
var value = values [i] ["value"];
if (((string)value ["description"]) == null)
value ["description"] = value ["value"]?.ToString();
Expand Down
Loading