Skip to content

Commit 8c02467

Browse files
authored
Merge pull request #13007 from dotnet-maestro-bot/merge/release/3.0-to-master
[automated] Merge branch 'release/3.0' => 'master'
2 parents 2e4274c + 920d801 commit 8c02467

File tree

164 files changed

+2289
-1595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+2289
-1595
lines changed

NuGet.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- Keep this file in sync with src/ProjectTemplates/test/Infrastructure/NuGet.config.in. -->
32
<configuration>
43
<packageSources>
54
<clear />

eng/PatchConfig.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Later on, this will be checked using this condition:
6565
</PropertyGroup>
6666
<PropertyGroup Condition=" '$(VersionPrefix)' == '2.2.7' ">
6767
<PackagesInPatch>
68+
Microsoft.AspNetCore.Hosting;
6869
</PackagesInPatch>
6970
</PropertyGroup>
7071
</Project>

src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,10 @@ public WebAssemblyHttpMessageHandler() { }
6565
}
6666
namespace Microsoft.AspNetCore.Blazor.Rendering
6767
{
68-
public partial class WebAssemblyRenderer : Microsoft.AspNetCore.Components.Rendering.Renderer
68+
public static partial class WebAssemblyEventDispatcher
6969
{
70-
public WebAssemblyRenderer(System.IServiceProvider serviceProvider, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) : base (default(System.IServiceProvider), default(Microsoft.Extensions.Logging.ILoggerFactory)) { }
71-
public override Microsoft.AspNetCore.Components.Dispatcher Dispatcher { get { throw null; } }
72-
public System.Threading.Tasks.Task AddComponentAsync(System.Type componentType, string domElementSelector) { throw null; }
73-
public System.Threading.Tasks.Task AddComponentAsync<TComponent>(string domElementSelector) where TComponent : Microsoft.AspNetCore.Components.IComponent { throw null; }
74-
public override System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo eventFieldInfo, System.EventArgs eventArgs) { throw null; }
75-
protected override void Dispose(bool disposing) { }
76-
protected override void HandleException(System.Exception exception) { }
77-
protected override System.Threading.Tasks.Task UpdateDisplayAsync(in Microsoft.AspNetCore.Components.Rendering.RenderBatch batch) { throw null; }
70+
[Microsoft.JSInterop.JSInvokableAttribute("DispatchEvent")]
71+
public static System.Threading.Tasks.Task DispatchEvent(Microsoft.AspNetCore.Components.Web.WebEventDescriptor eventDescriptor, string eventArgsJson) { throw null; }
7872
}
7973
}
8074
namespace Microsoft.AspNetCore.Components.Builder

src/Components/Blazor/Blazor/src/Microsoft.AspNetCore.Blazor.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
@@ -11,4 +11,10 @@
1111
<Reference Include="Microsoft.AspNetCore.Components.Web" />
1212
</ItemGroup>
1313

14+
<ItemGroup>
15+
<Compile Include="..\..\..\Shared\src\BrowserNavigationManagerInterop.cs" />
16+
<Compile Include="..\..\..\Shared\src\JsonSerializerOptionsProvider.cs" />
17+
<Compile Include="..\..\..\Shared\src\WebEventData.cs" />
18+
</ItemGroup>
19+
1420
</Project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Collections.Generic;
6+
7+
namespace Microsoft.AspNetCore.Blazor.Rendering
8+
{
9+
internal static class RendererRegistry
10+
{
11+
// In case there are multiple concurrent Blazor renderers in the same .NET WebAssembly
12+
// process, we track them by ID. This allows events to be dispatched to the correct one,
13+
// as well as rooting them for GC purposes, since nothing would otherwise be referencing
14+
// them even though we might still receive incoming events from JS.
15+
16+
private static int _nextId;
17+
private static Dictionary<int, WebAssemblyRenderer> _renderers = new Dictionary<int, WebAssemblyRenderer>();
18+
19+
internal static WebAssemblyRenderer Find(int rendererId)
20+
{
21+
return _renderers.ContainsKey(rendererId)
22+
? _renderers[rendererId]
23+
: throw new ArgumentException($"There is no renderer with ID {rendererId}.");
24+
}
25+
26+
public static int Add(WebAssemblyRenderer renderer)
27+
{
28+
var id = _nextId++;
29+
_renderers.Add(id, renderer);
30+
return id;
31+
}
32+
33+
public static bool TryRemove(int rendererId)
34+
{
35+
if (_renderers.ContainsKey(rendererId))
36+
{
37+
_renderers.Remove(rendererId);
38+
return true;
39+
}
40+
else
41+
{
42+
return false;
43+
}
44+
}
45+
}
46+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Components.Web;
6+
using Microsoft.JSInterop;
7+
8+
namespace Microsoft.AspNetCore.Blazor.Rendering
9+
{
10+
/// <summary>
11+
/// Dispatches events from JavaScript to a Blazor WebAssembly renderer.
12+
/// Intended for internal use only.
13+
/// </summary>
14+
public static class WebAssemblyEventDispatcher
15+
{
16+
/// <summary>
17+
/// For framework use only.
18+
/// </summary>
19+
[JSInvokable(nameof(DispatchEvent))]
20+
public static Task DispatchEvent(WebEventDescriptor eventDescriptor, string eventArgsJson)
21+
{
22+
var webEvent = WebEventData.Parse(eventDescriptor, eventArgsJson);
23+
var renderer = RendererRegistry.Find(eventDescriptor.BrowserRendererId);
24+
return renderer.DispatchEventAsync(
25+
webEvent.EventHandlerId,
26+
webEvent.EventFieldInfo,
27+
webEvent.EventArgs);
28+
}
29+
}
30+
}

src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Threading.Tasks;
77
using Microsoft.AspNetCore.Blazor.Services;
88
using Microsoft.AspNetCore.Components;
9-
using Microsoft.AspNetCore.Components.Web;
109
using Microsoft.AspNetCore.Components.Rendering;
1110
using Microsoft.Extensions.Logging;
1211

@@ -16,7 +15,7 @@ namespace Microsoft.AspNetCore.Blazor.Rendering
1615
/// Provides mechanisms for rendering <see cref="IComponent"/> instances in a
1716
/// web browser, dispatching events to them, and refreshing the UI as required.
1817
/// </summary>
19-
public class WebAssemblyRenderer : Renderer
18+
internal class WebAssemblyRenderer : Renderer
2019
{
2120
private readonly int _webAssemblyRendererId;
2221

@@ -31,10 +30,8 @@ public class WebAssemblyRenderer : Renderer
3130
public WebAssemblyRenderer(IServiceProvider serviceProvider, ILoggerFactory loggerFactory)
3231
: base(serviceProvider, loggerFactory)
3332
{
34-
// The browser renderer registers and unregisters itself with the static
35-
// registry. This works well with the WebAssembly runtime, and is simple for the
36-
// case where Blazor is running in process.
37-
_webAssemblyRendererId = RendererRegistry.Current.Add(this);
33+
// The WebAssembly renderer registers and unregisters itself with the static registry
34+
_webAssemblyRendererId = RendererRegistry.Add(this);
3835
}
3936

4037
public override Dispatcher Dispatcher => NullDispatcher.Instance;
@@ -77,9 +74,9 @@ public Task AddComponentAsync(Type componentType, string domElementSelector)
7774

7875
WebAssemblyJSRuntime.Instance.Invoke<object>(
7976
"Blazor._internal.attachRootComponentToElement",
80-
_webAssemblyRendererId,
8177
domElementSelector,
82-
componentId);
78+
componentId,
79+
_webAssemblyRendererId);
8380

8481
return RenderRootComponentAsync(componentId);
8582
}
@@ -88,7 +85,7 @@ public Task AddComponentAsync(Type componentType, string domElementSelector)
8885
protected override void Dispose(bool disposing)
8986
{
9087
base.Dispose(disposing);
91-
RendererRegistry.Current.TryRemove(_webAssemblyRendererId);
88+
RendererRegistry.TryRemove(_webAssemblyRendererId);
9289
}
9390

9491
/// <inheritdoc />

src/Components/Blazor/Templates/src/content/BlazorWasm-CSharp/Client/Shared/SurveyPrompt.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<span class="text-nowrap">
66
Please take our
7-
<a target="_blank" class="font-weight-bold" href="https://go.microsoft.com/fwlink/?linkid=2098127">brief survey</a>
7+
<a target="_blank" class="font-weight-bold" href="https://go.microsoft.com/fwlink/?linkid=2100553">brief survey</a>
88
</span>
99
and tell us what you think.
1010
</div>

src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public sealed partial class CascadingParameterAttribute : System.Attribute
114114
public CascadingParameterAttribute() { }
115115
public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
116116
}
117-
public partial class CascadingValue<T> : Microsoft.AspNetCore.Components.IComponent
117+
public partial class CascadingValue<TValue> : Microsoft.AspNetCore.Components.IComponent
118118
{
119119
public CascadingValue() { }
120120
[Microsoft.AspNetCore.Components.ParameterAttribute]
@@ -124,7 +124,7 @@ public CascadingValue() { }
124124
[Microsoft.AspNetCore.Components.ParameterAttribute]
125125
public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
126126
[Microsoft.AspNetCore.Components.ParameterAttribute]
127-
public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
127+
public TValue Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
128128
public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { }
129129
public System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters) { throw null; }
130130
}
@@ -188,17 +188,17 @@ public EventCallbackFactory() { }
188188
public Microsoft.AspNetCore.Components.EventCallback Create(object receiver, System.Func<object, System.Threading.Tasks.Task> callback) { throw null; }
189189
public Microsoft.AspNetCore.Components.EventCallback Create(object receiver, System.Func<System.Threading.Tasks.Task> callback) { throw null; }
190190
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
191-
public Microsoft.AspNetCore.Components.EventCallback<T> CreateInferred<T>(object receiver, System.Action<T> callback, T value) { throw null; }
191+
public Microsoft.AspNetCore.Components.EventCallback<TValue> CreateInferred<TValue>(object receiver, System.Action<TValue> callback, TValue value) { throw null; }
192192
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
193-
public Microsoft.AspNetCore.Components.EventCallback<T> CreateInferred<T>(object receiver, System.Func<T, System.Threading.Tasks.Task> callback, T value) { throw null; }
193+
public Microsoft.AspNetCore.Components.EventCallback<TValue> CreateInferred<TValue>(object receiver, System.Func<TValue, System.Threading.Tasks.Task> callback, TValue value) { throw null; }
194194
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
195-
public Microsoft.AspNetCore.Components.EventCallback<T> Create<T>(object receiver, Microsoft.AspNetCore.Components.EventCallback callback) { throw null; }
195+
public Microsoft.AspNetCore.Components.EventCallback<TValue> Create<TValue>(object receiver, Microsoft.AspNetCore.Components.EventCallback callback) { throw null; }
196196
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
197-
public Microsoft.AspNetCore.Components.EventCallback<T> Create<T>(object receiver, Microsoft.AspNetCore.Components.EventCallback<T> callback) { throw null; }
198-
public Microsoft.AspNetCore.Components.EventCallback<T> Create<T>(object receiver, System.Action callback) { throw null; }
199-
public Microsoft.AspNetCore.Components.EventCallback<T> Create<T>(object receiver, System.Action<T> callback) { throw null; }
200-
public Microsoft.AspNetCore.Components.EventCallback<T> Create<T>(object receiver, System.Func<System.Threading.Tasks.Task> callback) { throw null; }
201-
public Microsoft.AspNetCore.Components.EventCallback<T> Create<T>(object receiver, System.Func<T, System.Threading.Tasks.Task> callback) { throw null; }
197+
public Microsoft.AspNetCore.Components.EventCallback<TValue> Create<TValue>(object receiver, Microsoft.AspNetCore.Components.EventCallback<TValue> callback) { throw null; }
198+
public Microsoft.AspNetCore.Components.EventCallback<TValue> Create<TValue>(object receiver, System.Action callback) { throw null; }
199+
public Microsoft.AspNetCore.Components.EventCallback<TValue> Create<TValue>(object receiver, System.Action<TValue> callback) { throw null; }
200+
public Microsoft.AspNetCore.Components.EventCallback<TValue> Create<TValue>(object receiver, System.Func<System.Threading.Tasks.Task> callback) { throw null; }
201+
public Microsoft.AspNetCore.Components.EventCallback<TValue> Create<TValue>(object receiver, System.Func<TValue, System.Threading.Tasks.Task> callback) { throw null; }
202202
}
203203
public static partial class EventCallbackFactoryBinderExtensions
204204
{
@@ -241,13 +241,13 @@ public readonly partial struct EventCallbackWorkItem
241241
public System.Threading.Tasks.Task InvokeAsync(object arg) { throw null; }
242242
}
243243
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
244-
public readonly partial struct EventCallback<T>
244+
public readonly partial struct EventCallback<TValue>
245245
{
246246
private readonly object _dummy;
247-
public static readonly Microsoft.AspNetCore.Components.EventCallback<T> Empty;
247+
public static readonly Microsoft.AspNetCore.Components.EventCallback<TValue> Empty;
248248
public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent receiver, System.MulticastDelegate @delegate) { throw null; }
249249
public bool HasDelegate { get { throw null; } }
250-
public System.Threading.Tasks.Task InvokeAsync(T arg) { throw null; }
250+
public System.Threading.Tasks.Task InvokeAsync(TValue arg) { throw null; }
251251
}
252252
public partial interface IComponent
253253
{
@@ -365,11 +365,11 @@ public readonly partial struct ParameterView
365365
public static Microsoft.AspNetCore.Components.ParameterView Empty { get { throw null; } }
366366
public static Microsoft.AspNetCore.Components.ParameterView FromDictionary(System.Collections.Generic.IDictionary<string, object> parameters) { throw null; }
367367
public Microsoft.AspNetCore.Components.ParameterView.Enumerator GetEnumerator() { throw null; }
368-
public T GetValueOrDefault<T>(string parameterName) { throw null; }
369-
public T GetValueOrDefault<T>(string parameterName, T defaultValue) { throw null; }
368+
public TValue GetValueOrDefault<TValue>(string parameterName) { throw null; }
369+
public TValue GetValueOrDefault<TValue>(string parameterName, TValue defaultValue) { throw null; }
370370
public void SetParameterProperties(object target) { }
371371
public System.Collections.Generic.IReadOnlyDictionary<string, object> ToDictionary() { throw null; }
372-
public bool TryGetValue<T>(string parameterName, out T result) { throw null; }
372+
public bool TryGetValue<TValue>(string parameterName, out TValue result) { throw null; }
373373
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
374374
public partial struct Enumerator
375375
{
@@ -380,7 +380,7 @@ public partial struct Enumerator
380380
}
381381
}
382382
public delegate void RenderFragment(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder builder);
383-
public delegate Microsoft.AspNetCore.Components.RenderFragment RenderFragment<T>(T value);
383+
public delegate Microsoft.AspNetCore.Components.RenderFragment RenderFragment<TValue>(TValue value);
384384
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
385385
public readonly partial struct RenderHandle
386386
{
@@ -466,7 +466,7 @@ public FieldChangedEventArgs(in Microsoft.AspNetCore.Components.Forms.FieldIdent
466466
public FieldIdentifier(object model, string fieldName) { throw null; }
467467
public string FieldName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
468468
public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
469-
public static Microsoft.AspNetCore.Components.Forms.FieldIdentifier Create<T>(System.Linq.Expressions.Expression<System.Func<T>> accessor) { throw null; }
469+
public static Microsoft.AspNetCore.Components.Forms.FieldIdentifier Create<TField>(System.Linq.Expressions.Expression<System.Func<TField>> accessor) { throw null; }
470470
public bool Equals(Microsoft.AspNetCore.Components.Forms.FieldIdentifier otherIdentifier) { throw null; }
471471
public override bool Equals(object obj) { throw null; }
472472
public override int GetHashCode() { throw null; }
@@ -556,13 +556,13 @@ public void AddAttribute(int sequence, string name, bool value) { }
556556
public void AddAttribute(int sequence, string name, System.MulticastDelegate value) { }
557557
public void AddAttribute(int sequence, string name, object value) { }
558558
public void AddAttribute(int sequence, string name, string value) { }
559-
public void AddAttribute<T>(int sequence, string name, Microsoft.AspNetCore.Components.EventCallback<T> value) { }
559+
public void AddAttribute<TArgument>(int sequence, string name, Microsoft.AspNetCore.Components.EventCallback<TArgument> value) { }
560560
public void AddComponentReferenceCapture(int sequence, System.Action<object> componentReferenceCaptureAction) { }
561561
public void AddContent(int sequence, Microsoft.AspNetCore.Components.MarkupString markupContent) { }
562562
public void AddContent(int sequence, Microsoft.AspNetCore.Components.RenderFragment fragment) { }
563563
public void AddContent(int sequence, object textContent) { }
564564
public void AddContent(int sequence, string textContent) { }
565-
public void AddContent<T>(int sequence, Microsoft.AspNetCore.Components.RenderFragment<T> fragment, T value) { }
565+
public void AddContent<TValue>(int sequence, Microsoft.AspNetCore.Components.RenderFragment<TValue> fragment, TValue value) { }
566566
public void AddElementReferenceCapture(int sequence, System.Action<Microsoft.AspNetCore.Components.ElementReference> elementReferenceCaptureAction) { }
567567
public void AddMarkupContent(int sequence, string markupContent) { }
568568
public void AddMultipleAttributes(int sequence, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, object>> attributes) { }

src/Components/Components/src/Auth/CascadingAuthenticationState.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@implements IDisposable
33
@inject AuthenticationStateProvider AuthenticationStateProvider
44

5-
<CascadingValue T="Task<AuthenticationState>" Value="@_currentAuthenticationStateTask" ChildContent="@ChildContent" />
5+
<CascadingValue TValue="Task<AuthenticationState>" Value="@_currentAuthenticationStateTask" ChildContent="@ChildContent" />
66

77
@code {
88
private Task<AuthenticationState> _currentAuthenticationStateTask;

0 commit comments

Comments
 (0)