Fix spelling and grammar in Components (#14137)
This commit is contained in:
parent
29e9c77026
commit
c74e9efd0e
|
|
@ -8,9 +8,9 @@ using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Components.Analyzers
|
namespace Microsoft.AspNetCore.Components.Analyzers
|
||||||
{
|
{
|
||||||
public class ComponentInternalUsageDiagnoticsAnalyzerTest : AnalyzerTestBase
|
public class ComponentInternalUsageDiagnosticsAnalyzerTest : AnalyzerTestBase
|
||||||
{
|
{
|
||||||
public ComponentInternalUsageDiagnoticsAnalyzerTest()
|
public ComponentInternalUsageDiagnosticsAnalyzerTest()
|
||||||
{
|
{
|
||||||
Analyzer = new ComponentInternalUsageDiagnosticAnalyzer();
|
Analyzer = new ComponentInternalUsageDiagnosticAnalyzer();
|
||||||
Runner = new ComponentAnalyzerDiagnosticAnalyzerRunner(Analyzer);
|
Runner = new ComponentAnalyzerDiagnosticAnalyzerRunner(Analyzer);
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using Microsoft.AspNetCore.Components.RenderTree;
|
using Microsoft.AspNetCore.Components.RenderTree;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Components.Analyzers.Tests.TestFiles.ComponentInternalUsageDiagnoticsAnalyzerTest
|
namespace Microsoft.AspNetCore.Components.Analyzers.Tests.TestFiles.ComponentInternalUsageDiagnosticsAnalyzerTest
|
||||||
{
|
{
|
||||||
class UsesRenderTreeFrameAsParameter
|
class UsesRenderTreeFrameAsParameter
|
||||||
{
|
{
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Components.RenderTree;
|
using Microsoft.AspNetCore.Components.RenderTree;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Components.Analyzers.Tests.TestFiles.ComponentInternalUsageDiagnoticsAnalyzerTest
|
namespace Microsoft.AspNetCore.Components.Analyzers.Tests.TestFiles.ComponentInternalUsageDiagnosticsAnalyzerTest
|
||||||
{
|
{
|
||||||
class UsesRenderTreeFrameTypeAsLocal
|
class UsesRenderTreeFrameTypeAsLocal
|
||||||
{
|
{
|
||||||
|
|
@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Blazor.Hosting
|
||||||
public static void Run(this IWebAssemblyHost host)
|
public static void Run(this IWebAssemblyHost host)
|
||||||
{
|
{
|
||||||
// Behave like async void, because we don't yet support async-main properly on WebAssembly.
|
// Behave like async void, because we don't yet support async-main properly on WebAssembly.
|
||||||
// However, don't actualy make this method async, because we rely on startup being synchronous
|
// However, don't actually make this method async, because we rely on startup being synchronous
|
||||||
// for things like attaching navigation event handlers.
|
// for things like attaching navigation event handlers.
|
||||||
host.StartAsync().ContinueWith(task =>
|
host.StartAsync().ContinueWith(task =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ namespace Test
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Render_ChildComponent_TriesToSetNonParamter()
|
public void Render_ChildComponent_TriesToSetNonParameter()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
AdditionalSyntaxTrees.Add(Parse(@"
|
AdditionalSyntaxTrees.Add(Parse(@"
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ namespace WsProxy {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "Debugger.paused": {
|
case "Debugger.paused": {
|
||||||
//TODO figure out how to stich out more frames and, in particular what happens when real wasm is on the stack
|
//TODO figure out how to stitch out more frames and, in particular what happens when real wasm is on the stack
|
||||||
var top_func = args? ["callFrames"]? [0]? ["functionName"]?.Value<string> ();
|
var top_func = args? ["callFrames"]? [0]? ["functionName"]?.Value<string> ();
|
||||||
if (top_func == "mono_wasm_fire_bp" || top_func == "_mono_wasm_fire_bp") {
|
if (top_func == "mono_wasm_fire_bp" || top_func == "_mono_wasm_fire_bp") {
|
||||||
await OnBreakPointHit (args, token);
|
await OnBreakPointHit (args, token);
|
||||||
|
|
@ -419,7 +419,7 @@ namespace WsProxy {
|
||||||
|
|
||||||
var res = await SendCommand("Runtime.evaluate", o, token);
|
var res = await SendCommand("Runtime.evaluate", o, token);
|
||||||
|
|
||||||
//if we fail we just buble that to the IDE (and let it panic over it)
|
//if we fail we just bubble that to the IDE (and let it panic over it)
|
||||||
if (res.IsErr)
|
if (res.IsErr)
|
||||||
{
|
{
|
||||||
SendResponse(msg_id, res, token);
|
SendResponse(msg_id, res, token);
|
||||||
|
|
@ -475,7 +475,7 @@ namespace WsProxy {
|
||||||
|
|
||||||
var res = await SendCommand ("Runtime.evaluate", o, token);
|
var res = await SendCommand ("Runtime.evaluate", o, token);
|
||||||
|
|
||||||
//if we fail we just buble that to the IDE (and let it panic over it)
|
//if we fail we just bubble that to the IDE (and let it panic over it)
|
||||||
if (res.IsErr) {
|
if (res.IsErr) {
|
||||||
SendResponse (msg_id, res, token);
|
SendResponse (msg_id, res, token);
|
||||||
return;
|
return;
|
||||||
|
|
@ -594,7 +594,7 @@ namespace WsProxy {
|
||||||
var res = await EnableBreakPoint (bp, token);
|
var res = await EnableBreakPoint (bp, token);
|
||||||
var ret_code = res.Value? ["result"]? ["value"]?.Value<int> ();
|
var ret_code = res.Value? ["result"]? ["value"]?.Value<int> ();
|
||||||
|
|
||||||
//if we fail we just buble that to the IDE (and let it panic over it)
|
//if we fail we just bubble that to the IDE (and let it panic over it)
|
||||||
if (!ret_code.HasValue) {
|
if (!ret_code.HasValue) {
|
||||||
//FIXME figure out how to inform the IDE of that.
|
//FIXME figure out how to inform the IDE of that.
|
||||||
Info ($"FAILED TO ENABLE BP {bp.LocalId}");
|
Info ($"FAILED TO ENABLE BP {bp.LocalId}");
|
||||||
|
|
@ -668,7 +668,7 @@ namespace WsProxy {
|
||||||
var res = await EnableBreakPoint (bp, token);
|
var res = await EnableBreakPoint (bp, token);
|
||||||
var ret_code = res.Value? ["result"]? ["value"]?.Value<int> ();
|
var ret_code = res.Value? ["result"]? ["value"]?.Value<int> ();
|
||||||
|
|
||||||
//if we fail we just buble that to the IDE (and let it panic over it)
|
//if we fail we just bubble that to the IDE (and let it panic over it)
|
||||||
if (!ret_code.HasValue) {
|
if (!ret_code.HasValue) {
|
||||||
SendResponse (msg_id, res, token);
|
SendResponse (msg_id, res, token);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -430,7 +430,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
|
|
||||||
private static string FormatEnumValueCore<T>(T value, CultureInfo culture) where T : struct, Enum
|
private static string FormatEnumValueCore<T>(T value, CultureInfo culture) where T : struct, Enum
|
||||||
{
|
{
|
||||||
return value.ToString(); // The overload that acccepts a culture is [Obsolete]
|
return value.ToString(); // The overload that accepts a culture is [Obsolete]
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string FormatNullableEnumValueCore<T>(T? value, CultureInfo culture) where T : struct, Enum
|
private static string FormatNullableEnumValueCore<T>(T? value, CultureInfo culture) where T : struct, Enum
|
||||||
|
|
@ -440,7 +440,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return value.Value.ToString(); // The overload that acccepts a culture is [Obsolete]
|
return value.Value.ToString(); // The overload that accepts a culture is [Obsolete]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1166,99 +1166,99 @@ namespace Microsoft.AspNetCore.Components
|
||||||
|
|
||||||
public static BindFormatter<T> Get<T>()
|
public static BindFormatter<T> Get<T>()
|
||||||
{
|
{
|
||||||
if (!_cache.TryGetValue(typeof(T), out var formattter))
|
if (!_cache.TryGetValue(typeof(T), out var formatter))
|
||||||
{
|
{
|
||||||
// We need to replicate all of the primitive cases that we handle here so that they will behave the same way.
|
// We need to replicate all of the primitive cases that we handle here so that they will behave the same way.
|
||||||
// The result will be cached.
|
// The result will be cached.
|
||||||
if (typeof(T) == typeof(string))
|
if (typeof(T) == typeof(string))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<string>)FormatStringValueCore;
|
formatter = (BindFormatter<string>)FormatStringValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(bool))
|
else if (typeof(T) == typeof(bool))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<bool>)FormatBoolValueCore;
|
formatter = (BindFormatter<bool>)FormatBoolValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(bool?))
|
else if (typeof(T) == typeof(bool?))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<bool?>)FormatNullableBoolValueCore;
|
formatter = (BindFormatter<bool?>)FormatNullableBoolValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(int))
|
else if (typeof(T) == typeof(int))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<int>)FormatIntValueCore;
|
formatter = (BindFormatter<int>)FormatIntValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(int?))
|
else if (typeof(T) == typeof(int?))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<int?>)FormatNullableIntValueCore;
|
formatter = (BindFormatter<int?>)FormatNullableIntValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(long))
|
else if (typeof(T) == typeof(long))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<long>)FormatLongValueCore;
|
formatter = (BindFormatter<long>)FormatLongValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(long?))
|
else if (typeof(T) == typeof(long?))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<long?>)FormatNullableLongValueCore;
|
formatter = (BindFormatter<long?>)FormatNullableLongValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(float))
|
else if (typeof(T) == typeof(float))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<float>)FormatFloatValueCore;
|
formatter = (BindFormatter<float>)FormatFloatValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(float?))
|
else if (typeof(T) == typeof(float?))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<float?>)FormatNullableFloatValueCore;
|
formatter = (BindFormatter<float?>)FormatNullableFloatValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(double))
|
else if (typeof(T) == typeof(double))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<double>)FormatDoubleValueCore;
|
formatter = (BindFormatter<double>)FormatDoubleValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(double?))
|
else if (typeof(T) == typeof(double?))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<double?>)FormatNullableDoubleValueCore;
|
formatter = (BindFormatter<double?>)FormatNullableDoubleValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(decimal))
|
else if (typeof(T) == typeof(decimal))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<decimal>)FormatDecimalValueCore;
|
formatter = (BindFormatter<decimal>)FormatDecimalValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(decimal?))
|
else if (typeof(T) == typeof(decimal?))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<decimal?>)FormatNullableDecimalValueCore;
|
formatter = (BindFormatter<decimal?>)FormatNullableDecimalValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(DateTime))
|
else if (typeof(T) == typeof(DateTime))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<DateTime>)FormatDateTimeValueCore;
|
formatter = (BindFormatter<DateTime>)FormatDateTimeValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(DateTime?))
|
else if (typeof(T) == typeof(DateTime?))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<DateTime?>)FormatNullableDateTimeValueCore;
|
formatter = (BindFormatter<DateTime?>)FormatNullableDateTimeValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(DateTimeOffset))
|
else if (typeof(T) == typeof(DateTimeOffset))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<DateTimeOffset>)FormatDateTimeOffsetValueCore;
|
formatter = (BindFormatter<DateTimeOffset>)FormatDateTimeOffsetValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(DateTimeOffset?))
|
else if (typeof(T) == typeof(DateTimeOffset?))
|
||||||
{
|
{
|
||||||
formattter = (BindFormatter<DateTimeOffset?>)FormatNullableDateTimeOffsetValueCore;
|
formatter = (BindFormatter<DateTimeOffset?>)FormatNullableDateTimeOffsetValueCore;
|
||||||
}
|
}
|
||||||
else if (typeof(T).IsEnum)
|
else if (typeof(T).IsEnum)
|
||||||
{
|
{
|
||||||
// We have to deal invoke this dynamically to work around the type constraint on Enum.TryParse.
|
// We have to deal invoke this dynamically to work around the type constraint on Enum.TryParse.
|
||||||
var method = _formatEnumValue ??= typeof(BindConverter).GetMethod(nameof(FormatEnumValueCore), BindingFlags.NonPublic | BindingFlags.Static);
|
var method = _formatEnumValue ??= typeof(BindConverter).GetMethod(nameof(FormatEnumValueCore), BindingFlags.NonPublic | BindingFlags.Static);
|
||||||
formattter = method.MakeGenericMethod(typeof(T)).CreateDelegate(typeof(BindFormatter<T>), target: null);
|
formatter = method.MakeGenericMethod(typeof(T)).CreateDelegate(typeof(BindFormatter<T>), target: null);
|
||||||
}
|
}
|
||||||
else if (Nullable.GetUnderlyingType(typeof(T)) is Type innerType && innerType.IsEnum)
|
else if (Nullable.GetUnderlyingType(typeof(T)) is Type innerType && innerType.IsEnum)
|
||||||
{
|
{
|
||||||
// We have to deal invoke this dynamically to work around the type constraint on Enum.TryParse.
|
// We have to deal invoke this dynamically to work around the type constraint on Enum.TryParse.
|
||||||
var method = _formatNullableEnumValue ??= typeof(BindConverter).GetMethod(nameof(FormatNullableEnumValueCore), BindingFlags.NonPublic | BindingFlags.Static);
|
var method = _formatNullableEnumValue ??= typeof(BindConverter).GetMethod(nameof(FormatNullableEnumValueCore), BindingFlags.NonPublic | BindingFlags.Static);
|
||||||
formattter = method.MakeGenericMethod(innerType).CreateDelegate(typeof(BindFormatter<T>), target: null);
|
formatter = method.MakeGenericMethod(innerType).CreateDelegate(typeof(BindFormatter<T>), target: null);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
formattter = MakeTypeConverterFormatter<T>();
|
formatter = MakeTypeConverterFormatter<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
_cache.TryAdd(typeof(T), formattter);
|
_cache.TryAdd(typeof(T), formatter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (BindFormatter<T>)formattter;
|
return (BindFormatter<T>)formatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BindFormatter<T> MakeTypeConverterFormatter<T>()
|
private static BindFormatter<T> MakeTypeConverterFormatter<T>()
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
|
|
||||||
_hasSetParametersPreviously = true;
|
_hasSetParametersPreviously = true;
|
||||||
|
|
||||||
// It's OK for the value to be null, but some "Value" param must be suppled
|
// It's OK for the value to be null, but some "Value" param must be supplied
|
||||||
// because it serves no useful purpose to have a <CascadingValue> otherwise.
|
// because it serves no useful purpose to have a <CascadingValue> otherwise.
|
||||||
if (!hasSuppliedValue)
|
if (!hasSuppliedValue)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
// about IComponent). This gives us flexibility to change the lifecycle concepts easily,
|
// about IComponent). This gives us flexibility to change the lifecycle concepts easily,
|
||||||
// or for developers to design their own lifecycles as different base classes.
|
// or for developers to design their own lifecycles as different base classes.
|
||||||
|
|
||||||
// TODO: When the component lifecycle design stabilises, add proper unit tests for ComponentBase.
|
// TODO: When the component lifecycle design stabilizes, add proper unit tests for ComponentBase.
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Optional base class for components. Alternatively, components may
|
/// Optional base class for components. Alternatively, components may
|
||||||
|
|
@ -136,7 +136,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// The <see cref="OnAfterRender(bool)"/> and <see cref="OnAfterRenderAsync(bool)"/> lifecycle methods
|
/// The <see cref="OnAfterRender(bool)"/> and <see cref="OnAfterRenderAsync(bool)"/> lifecycle methods
|
||||||
/// are useful for performing interop, or interacting with values recieved from <c>@ref</c>.
|
/// are useful for performing interop, or interacting with values received from <c>@ref</c>.
|
||||||
/// Use the <paramref name="firstRender"/> parameter to ensure that initialization work is only performed
|
/// Use the <paramref name="firstRender"/> parameter to ensure that initialization work is only performed
|
||||||
/// once.
|
/// once.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
@ -156,7 +156,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
/// <returns>A <see cref="Task"/> representing any asynchronous operation.</returns>
|
/// <returns>A <see cref="Task"/> representing any asynchronous operation.</returns>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// The <see cref="OnAfterRender(bool)"/> and <see cref="OnAfterRenderAsync(bool)"/> lifecycle methods
|
/// The <see cref="OnAfterRender(bool)"/> and <see cref="OnAfterRenderAsync(bool)"/> lifecycle methods
|
||||||
/// are useful for performing interop, or interacting with values recieved from <c>@ref</c>.
|
/// are useful for performing interop, or interacting with values received from <c>@ref</c>.
|
||||||
/// Use the <paramref name="firstRender"/> parameter to ensure that initialization work is only performed
|
/// Use the <paramref name="firstRender"/> parameter to ensure that initialization work is only performed
|
||||||
/// once.
|
/// once.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
@ -246,7 +246,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
}
|
}
|
||||||
catch // avoiding exception filters for AOT runtime support
|
catch // avoiding exception filters for AOT runtime support
|
||||||
{
|
{
|
||||||
// Ignore exceptions from task cancelletions.
|
// Ignore exceptions from task cancellations.
|
||||||
// Awaiting a canceled task may produce either an OperationCanceledException (if produced as a consequence of
|
// Awaiting a canceled task may produce either an OperationCanceledException (if produced as a consequence of
|
||||||
// CancellationToken.ThrowIfCancellationRequested()) or a TaskCanceledException (produced as a consequence of awaiting Task.FromCanceled).
|
// CancellationToken.ThrowIfCancellationRequested()) or a TaskCanceledException (produced as a consequence of awaiting Task.FromCanceled).
|
||||||
// It's much easier to check the state of the Task (i.e. Task.IsCanceled) rather than catch two distinct exceptions.
|
// It's much easier to check the state of the Task (i.e. Task.IsCanceled) rather than catch two distinct exceptions.
|
||||||
|
|
@ -289,7 +289,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
}
|
}
|
||||||
catch // avoiding exception filters for AOT runtime support
|
catch // avoiding exception filters for AOT runtime support
|
||||||
{
|
{
|
||||||
// Ignore exceptions from task cancelletions, but don't bother issuing a state change.
|
// Ignore exceptions from task cancellations, but don't bother issuing a state change.
|
||||||
if (task.IsCanceled)
|
if (task.IsCanceled)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ namespace Microsoft.AspNetCore.Components
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//
|
//
|
||||||
// NOTE: for number parsing, the HTML5 spec dictates that <input type="number"> the DOM will represent
|
// NOTE: for number parsing, the HTML5 spec dictates that <input type="number"> the DOM will represent
|
||||||
// number values as floating point numbers using `.` as the period separator. This is NOT culture senstive.
|
// number values as floating point numbers using `.` as the period separator. This is NOT culture sensitive.
|
||||||
// Put another way, the user might see `,` as their decimal separator, but the value available in events
|
// Put another way, the user might see `,` as their decimal separator, but the value available in events
|
||||||
// to JS code is always simpilar to what .NET parses with InvariantCulture.
|
// to JS code is always similar to what .NET parses with InvariantCulture.
|
||||||
//
|
//
|
||||||
// See: https://www.w3.org/TR/html5/sec-forms.html#number-state-typenumber
|
// See: https://www.w3.org/TR/html5/sec-forms.html#number-state-typenumber
|
||||||
// See: https://www.w3.org/TR/html5/infrastructure.html#valid-floating-point-number
|
// See: https://www.w3.org/TR/html5/infrastructure.html#valid-floating-point-number
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Components.Routing;
|
||||||
namespace Microsoft.AspNetCore.Components
|
namespace Microsoft.AspNetCore.Components
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides an abstraction for querying and mananging URI navigation.
|
/// Provides an abstraction for querying and managing URI navigation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class NavigationManager
|
public abstract class NavigationManager
|
||||||
{
|
{
|
||||||
|
|
@ -134,7 +134,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows derived classes to lazyly self-initialize. Implementations that support lazy-initialization should override
|
/// Allows derived classes to lazily self-initialize. Implementations that support lazy-initialization should override
|
||||||
/// this method and call <see cref="Initialize(string, string)" />.
|
/// this method and call <see cref="Initialize(string, string)" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void EnsureInitialized()
|
protected virtual void EnsureInitialized()
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree
|
||||||
public enum RenderTreeFrameType: short
|
public enum RenderTreeFrameType: short
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used only for unintialized frames.
|
/// Used only for uninitialized frames.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree
|
||||||
// remaining work.
|
// remaining work.
|
||||||
// During the synchronous rendering process we don't wait for the pending asynchronous
|
// During the synchronous rendering process we don't wait for the pending asynchronous
|
||||||
// work to finish as it will simply trigger new renders that will be handled afterwards.
|
// work to finish as it will simply trigger new renders that will be handled afterwards.
|
||||||
// During the asynchronous rendering process we want to wait up untill al components have
|
// During the asynchronous rendering process we want to wait up until all components have
|
||||||
// finished rendering so that we can produce the complete output.
|
// finished rendering so that we can produce the complete output.
|
||||||
var componentState = GetRequiredComponentState(componentId);
|
var componentState = GetRequiredComponentState(componentId);
|
||||||
componentState.SetDirectParameters(initialParameters);
|
componentState.SetDirectParameters(initialParameters);
|
||||||
|
|
@ -388,7 +388,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processses pending renders requests from components if there are any.
|
/// Processes pending renders requests from components if there are any.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void ProcessPendingRender()
|
protected virtual void ProcessPendingRender()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
|
||||||
AssertCanAddAttribute();
|
AssertCanAddAttribute();
|
||||||
if (_lastNonAttributeFrameType == RenderTreeFrameType.Component)
|
if (_lastNonAttributeFrameType == RenderTreeFrameType.Component)
|
||||||
{
|
{
|
||||||
// Since this is a component, we need to preserve the type of the EventCallabck, so we have
|
// Since this is a component, we need to preserve the type of the EventCallback, so we have
|
||||||
// to box.
|
// to box.
|
||||||
Append(RenderTreeFrame.Attribute(sequence, name, (object)value));
|
Append(RenderTreeFrame.Attribute(sequence, name, (object)value));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,20 +147,20 @@ namespace Microsoft.AspNetCore.Components.Rendering
|
||||||
// synchronously runs the callback
|
// synchronously runs the callback
|
||||||
public override void Send(SendOrPostCallback d, object state)
|
public override void Send(SendOrPostCallback d, object state)
|
||||||
{
|
{
|
||||||
Task antecedant;
|
Task antecedent;
|
||||||
var completion = new TaskCompletionSource<object>();
|
var completion = new TaskCompletionSource<object>();
|
||||||
|
|
||||||
lock (_state.Lock)
|
lock (_state.Lock)
|
||||||
{
|
{
|
||||||
antecedant = _state.Task;
|
antecedent = _state.Task;
|
||||||
_state.Task = completion.Task;
|
_state.Task = completion.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have to block. That's the contract of Send - we don't expect this to be used
|
// We have to block. That's the contract of Send - we don't expect this to be used
|
||||||
// in many scenarios in Components.
|
// in many scenarios in Components.
|
||||||
//
|
//
|
||||||
// Using Wait here is ok because the antecedant task will never throw.
|
// Using Wait here is ok because the antecedent task will never throw.
|
||||||
antecedant.Wait();
|
antecedent.Wait();
|
||||||
|
|
||||||
ExecuteSynchronously(completion, d, state);
|
ExecuteSynchronously(completion, d, state);
|
||||||
}
|
}
|
||||||
|
|
@ -195,7 +195,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
|
||||||
ExecuteSynchronously(completion, d, state);
|
ExecuteSynchronously(completion, d, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task Enqueue(Task antecedant, SendOrPostCallback d, object state, bool forceAsync = false)
|
private Task Enqueue(Task antecedent, SendOrPostCallback d, object state, bool forceAsync = false)
|
||||||
{
|
{
|
||||||
// If we get here is means that a callback is being explicitly queued. Let's instead add it to the queue and yield.
|
// If we get here is means that a callback is being explicitly queued. Let's instead add it to the queue and yield.
|
||||||
//
|
//
|
||||||
|
|
@ -212,7 +212,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
|
||||||
}
|
}
|
||||||
|
|
||||||
var flags = forceAsync ? TaskContinuationOptions.RunContinuationsAsynchronously : TaskContinuationOptions.None;
|
var flags = forceAsync ? TaskContinuationOptions.RunContinuationsAsynchronously : TaskContinuationOptions.None;
|
||||||
return antecedant.ContinueWith(BackgroundWorkThunk, new WorkItem()
|
return antecedent.ContinueWith(BackgroundWorkThunk, new WorkItem()
|
||||||
{
|
{
|
||||||
SynchronizationContext = this,
|
SynchronizationContext = this,
|
||||||
ExecutionContext = executionContext,
|
ExecutionContext = executionContext,
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ namespace Microsoft.AspNetCore.Components.Test
|
||||||
|
|
||||||
// Act/Assert 2: Re-render the CascadingValue; observe nested component wasn't re-rendered
|
// Act/Assert 2: Re-render the CascadingValue; observe nested component wasn't re-rendered
|
||||||
providedValue = "Updated value";
|
providedValue = "Updated value";
|
||||||
displayNestedComponent = false; // Remove the nested componet
|
displayNestedComponent = false; // Remove the nested component
|
||||||
component.TriggerRender();
|
component.TriggerRender();
|
||||||
|
|
||||||
// Assert: We did not render the nested component now it's been removed
|
// Assert: We did not render the nested component now it's been removed
|
||||||
|
|
|
||||||
|
|
@ -366,7 +366,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
public void HasDuplicateCaptureUnmatchedValuesParameters_Throws()
|
public void HasDuplicateCaptureUnmatchedValuesParameters_Throws()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var target = new HasDupliateCaptureUnmatchedValuesProperty();
|
var target = new HasDuplicateCaptureUnmatchedValuesProperty();
|
||||||
var parameters = new ParameterViewBuilder().Build();
|
var parameters = new ParameterViewBuilder().Build();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -374,17 +374,17 @@ namespace Microsoft.AspNetCore.Components
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(
|
Assert.Equal(
|
||||||
$"Multiple properties were found on component type '{typeof(HasDupliateCaptureUnmatchedValuesProperty).FullName}' " +
|
$"Multiple properties were found on component type '{typeof(HasDuplicateCaptureUnmatchedValuesProperty).FullName}' " +
|
||||||
$"with '{nameof(ParameterAttribute)}.{nameof(ParameterAttribute.CaptureUnmatchedValues)}'. " +
|
$"with '{nameof(ParameterAttribute)}.{nameof(ParameterAttribute.CaptureUnmatchedValues)}'. " +
|
||||||
$"Only a single property per type can use '{nameof(ParameterAttribute)}.{nameof(ParameterAttribute.CaptureUnmatchedValues)}'. " +
|
$"Only a single property per type can use '{nameof(ParameterAttribute)}.{nameof(ParameterAttribute.CaptureUnmatchedValues)}'. " +
|
||||||
$"Properties:" + Environment.NewLine +
|
$"Properties:" + Environment.NewLine +
|
||||||
$"{nameof(HasDupliateCaptureUnmatchedValuesProperty.CaptureUnmatchedValuesProp1)}" + Environment.NewLine +
|
$"{nameof(HasDuplicateCaptureUnmatchedValuesProperty.CaptureUnmatchedValuesProp1)}" + Environment.NewLine +
|
||||||
$"{nameof(HasDupliateCaptureUnmatchedValuesProperty.CaptureUnmatchedValuesProp2)}",
|
$"{nameof(HasDuplicateCaptureUnmatchedValuesProperty.CaptureUnmatchedValuesProp2)}",
|
||||||
ex.Message);
|
ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void HasCaptureUnmatchedValuesParameteterWithWrongType_Throws()
|
public void HasCaptureUnmatchedValuesParameterWithWrongType_Throws()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var target = new HasWrongTypeCaptureUnmatchedValuesProperty();
|
var target = new HasWrongTypeCaptureUnmatchedValuesProperty();
|
||||||
|
|
@ -630,7 +630,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
[Parameter(CaptureUnmatchedValues = true)] public IReadOnlyDictionary<string, object> CaptureUnmatchedValues { get; set; }
|
[Parameter(CaptureUnmatchedValues = true)] public IReadOnlyDictionary<string, object> CaptureUnmatchedValues { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class HasDupliateCaptureUnmatchedValuesProperty
|
class HasDuplicateCaptureUnmatchedValuesProperty
|
||||||
{
|
{
|
||||||
[Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> CaptureUnmatchedValuesProp1 { get; set; }
|
[Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> CaptureUnmatchedValuesProp1 { get; set; }
|
||||||
[Parameter(CaptureUnmatchedValues = true)] public IDictionary<string, object> CaptureUnmatchedValuesProp2 { get; set; }
|
[Parameter(CaptureUnmatchedValues = true)] public IDictionary<string, object> CaptureUnmatchedValuesProp2 { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,7 @@ namespace Microsoft.AspNetCore.Components.Test
|
||||||
[Fact]
|
[Fact]
|
||||||
public void HandlesKeyBeingAdded()
|
public void HandlesKeyBeingAdded()
|
||||||
{
|
{
|
||||||
// This is an anomolous situation that can't occur with .razor components.
|
// This is an anomalous situation that can't occur with .razor components.
|
||||||
// It represents the case where, for the same sequence number, we have an
|
// It represents the case where, for the same sequence number, we have an
|
||||||
// old frame without a key and a new frame with a key.
|
// old frame without a key and a new frame with a key.
|
||||||
|
|
||||||
|
|
@ -472,7 +472,7 @@ namespace Microsoft.AspNetCore.Components.Test
|
||||||
[Fact]
|
[Fact]
|
||||||
public void HandlesKeyBeingRemoved()
|
public void HandlesKeyBeingRemoved()
|
||||||
{
|
{
|
||||||
// This is an anomolous situation that can't occur with .razor components.
|
// This is an anomalous situation that can't occur with .razor components.
|
||||||
// It represents the case where, for the same sequence number, we have an
|
// It represents the case where, for the same sequence number, we have an
|
||||||
// old frame with a key and a new frame without a key.
|
// old frame with a key and a new frame without a key.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3574,7 +3574,7 @@ namespace Microsoft.AspNetCore.Components.Test
|
||||||
// Act &A Assert
|
// Act &A Assert
|
||||||
renderer.Dispose();
|
renderer.Dispose();
|
||||||
|
|
||||||
// All components must be disposed even if some throw as part of being diposed.
|
// All components must be disposed even if some throw as part of being disposed.
|
||||||
Assert.True(component.Disposed);
|
Assert.True(component.Disposed);
|
||||||
var aex = Assert.IsType<AggregateException>(Assert.Single(renderer.HandledExceptions));
|
var aex = Assert.IsType<AggregateException>(Assert.Single(renderer.HandledExceptions));
|
||||||
Assert.Contains(exception1, aex.InnerExceptions);
|
Assert.Contains(exception1, aex.InnerExceptions);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Post_RunsAynchronously_WhenNotBusy_Exception()
|
public void Post_RunsAsynchronously_WhenNotBusy_Exception()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var context = new RendererSynchronizationContext();
|
var context = new RendererSynchronizationContext();
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Components.Server
|
namespace Microsoft.AspNetCore.Components.Server
|
||||||
{
|
{
|
||||||
// We use a middlware so that we can use DI.
|
// We use a middleware so that we can use DI.
|
||||||
internal class CircuitDisconnectMiddleware
|
internal class CircuitDisconnectMiddleware
|
||||||
{
|
{
|
||||||
private const string CircuitIdKey = "circuitId";
|
private const string CircuitIdKey = "circuitId";
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Components.Server
|
||||||
/// without losing any state in the event of transient connection issues.
|
/// without losing any state in the event of transient connection issues.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// <para>
|
/// <para>
|
||||||
/// This value determines the maximium number of circuit states retained by the server.
|
/// This value determines the maximum number of circuit states retained by the server.
|
||||||
/// <seealso cref="DisconnectedCircuitRetentionPeriod"/>
|
/// <seealso cref="DisconnectedCircuitRetentionPeriod"/>
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Components.Server
|
||||||
/// without losing any state in the event of transient connection issues.
|
/// without losing any state in the event of transient connection issues.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// <para>
|
/// <para>
|
||||||
/// This value determines the maximium duration circuit state is retained by the server before being evicted.
|
/// This value determines the maximum duration circuit state is retained by the server before being evicted.
|
||||||
/// <seealso cref="DisconnectedCircuitMaxRetained"/>
|
/// <seealso cref="DisconnectedCircuitMaxRetained"/>
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
|
|
||||||
// EndInvokeJSFromDotNet is used in a fire-and-forget context, so it's responsible for its own
|
// EndInvokeJSFromDotNet is used in a fire-and-forget context, so it's responsible for its own
|
||||||
// error handling.
|
// error handling.
|
||||||
public async Task EndInvokeJSFromDotNet(long asyncCall, bool succeded, string arguments)
|
public async Task EndInvokeJSFromDotNet(long asyncCall, bool succeeded, string arguments)
|
||||||
{
|
{
|
||||||
AssertInitialized();
|
AssertInitialized();
|
||||||
AssertNotDisposed();
|
AssertNotDisposed();
|
||||||
|
|
@ -364,7 +364,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
{
|
{
|
||||||
await Renderer.Dispatcher.InvokeAsync(() =>
|
await Renderer.Dispatcher.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
if (!succeded)
|
if (!succeeded)
|
||||||
{
|
{
|
||||||
// We can log the arguments here because it is simply the JS error with the call stack.
|
// We can log the arguments here because it is simply the JS error with the call stack.
|
||||||
Log.EndInvokeJSFailed(_logger, asyncCall, arguments);
|
Log.EndInvokeJSFailed(_logger, asyncCall, arguments);
|
||||||
|
|
@ -577,11 +577,11 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
|
|
||||||
private static class Log
|
private static class Log
|
||||||
{
|
{
|
||||||
private static readonly Action<ILogger, Exception> _intializationStarted;
|
private static readonly Action<ILogger, Exception> _initializationStarted;
|
||||||
private static readonly Action<ILogger, Exception> _intializationSucceded;
|
private static readonly Action<ILogger, Exception> _initializationSucceded;
|
||||||
private static readonly Action<ILogger, Exception> _intializationFailed;
|
private static readonly Action<ILogger, Exception> _initializationFailed;
|
||||||
private static readonly Action<ILogger, CircuitId, Exception> _disposeStarted;
|
private static readonly Action<ILogger, CircuitId, Exception> _disposeStarted;
|
||||||
private static readonly Action<ILogger, CircuitId, Exception> _disposeSucceded;
|
private static readonly Action<ILogger, CircuitId, Exception> _disposeSucceeded;
|
||||||
private static readonly Action<ILogger, CircuitId, Exception> _disposeFailed;
|
private static readonly Action<ILogger, CircuitId, Exception> _disposeFailed;
|
||||||
private static readonly Action<ILogger, CircuitId, Exception> _onCircuitOpened;
|
private static readonly Action<ILogger, CircuitId, Exception> _onCircuitOpened;
|
||||||
private static readonly Action<ILogger, CircuitId, string, Exception> _onConnectionUp;
|
private static readonly Action<ILogger, CircuitId, string, Exception> _onConnectionUp;
|
||||||
|
|
@ -639,7 +639,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
public static readonly EventId EndInvokeJSSucceeded = new EventId(206, "EndInvokeJSSucceeded");
|
public static readonly EventId EndInvokeJSSucceeded = new EventId(206, "EndInvokeJSSucceeded");
|
||||||
public static readonly EventId DispatchEventThroughJSInterop = new EventId(207, "DispatchEventThroughJSInterop");
|
public static readonly EventId DispatchEventThroughJSInterop = new EventId(207, "DispatchEventThroughJSInterop");
|
||||||
public static readonly EventId LocationChange = new EventId(208, "LocationChange");
|
public static readonly EventId LocationChange = new EventId(208, "LocationChange");
|
||||||
public static readonly EventId LocationChangeSucceded = new EventId(209, "LocationChangeSucceeded");
|
public static readonly EventId LocationChangeSucceeded = new EventId(209, "LocationChangeSucceeded");
|
||||||
public static readonly EventId LocationChangeFailed = new EventId(210, "LocationChangeFailed");
|
public static readonly EventId LocationChangeFailed = new EventId(210, "LocationChangeFailed");
|
||||||
public static readonly EventId LocationChangeFailedInCircuit = new EventId(211, "LocationChangeFailedInCircuit");
|
public static readonly EventId LocationChangeFailedInCircuit = new EventId(211, "LocationChangeFailedInCircuit");
|
||||||
public static readonly EventId OnRenderCompletedFailed = new EventId(212, "OnRenderCompletedFailed");
|
public static readonly EventId OnRenderCompletedFailed = new EventId(212, "OnRenderCompletedFailed");
|
||||||
|
|
@ -647,17 +647,17 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
|
|
||||||
static Log()
|
static Log()
|
||||||
{
|
{
|
||||||
_intializationStarted = LoggerMessage.Define(
|
_initializationStarted = LoggerMessage.Define(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
EventIds.InitializationStarted,
|
EventIds.InitializationStarted,
|
||||||
"Circuit initialization started.");
|
"Circuit initialization started.");
|
||||||
|
|
||||||
_intializationSucceded = LoggerMessage.Define(
|
_initializationSucceded = LoggerMessage.Define(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
EventIds.InitializationSucceeded,
|
EventIds.InitializationSucceeded,
|
||||||
"Circuit initialization succeeded.");
|
"Circuit initialization succeeded.");
|
||||||
|
|
||||||
_intializationFailed = LoggerMessage.Define(
|
_initializationFailed = LoggerMessage.Define(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
EventIds.InitializationFailed,
|
EventIds.InitializationFailed,
|
||||||
"Circuit initialization failed.");
|
"Circuit initialization failed.");
|
||||||
|
|
@ -667,10 +667,10 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
EventIds.DisposeStarted,
|
EventIds.DisposeStarted,
|
||||||
"Disposing circuit '{CircuitId}' started.");
|
"Disposing circuit '{CircuitId}' started.");
|
||||||
|
|
||||||
_disposeSucceded = LoggerMessage.Define<CircuitId>(
|
_disposeSucceeded = LoggerMessage.Define<CircuitId>(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
EventIds.DisposeSucceeded,
|
EventIds.DisposeSucceeded,
|
||||||
"Disposing circuit '{CircuitId}' succeded.");
|
"Disposing circuit '{CircuitId}' succeeded.");
|
||||||
|
|
||||||
_disposeFailed = LoggerMessage.Define<CircuitId>(
|
_disposeFailed = LoggerMessage.Define<CircuitId>(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
|
|
@ -725,7 +725,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
_unhandledExceptionClientDisconnected = LoggerMessage.Define<CircuitId>(
|
_unhandledExceptionClientDisconnected = LoggerMessage.Define<CircuitId>(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
EventIds.UnhandledExceptionClientDisconnected,
|
EventIds.UnhandledExceptionClientDisconnected,
|
||||||
"An exception ocurred on the circuit host '{CircuitId}' while the client is disconnected.");
|
"An exception occurred on the circuit host '{CircuitId}' while the client is disconnected.");
|
||||||
|
|
||||||
_beginInvokeDotNetStatic = LoggerMessage.Define<string, string, string>(
|
_beginInvokeDotNetStatic = LoggerMessage.Define<string, string, string>(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
|
|
@ -779,8 +779,8 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
|
|
||||||
_locationChangeSucceeded = LoggerMessage.Define<string, CircuitId>(
|
_locationChangeSucceeded = LoggerMessage.Define<string, CircuitId>(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
EventIds.LocationChangeSucceded,
|
EventIds.LocationChangeSucceeded,
|
||||||
"Location change to '{URI}' in circuit '{CircuitId}' succeded.");
|
"Location change to '{URI}' in circuit '{CircuitId}' succeeded.");
|
||||||
|
|
||||||
_locationChangeFailed = LoggerMessage.Define<string, CircuitId>(
|
_locationChangeFailed = LoggerMessage.Define<string, CircuitId>(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
|
|
@ -798,11 +798,11 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
"Failed to complete render batch '{RenderId}' in circuit host '{CircuitId}'.");
|
"Failed to complete render batch '{RenderId}' in circuit host '{CircuitId}'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InitializationStarted(ILogger logger) => _intializationStarted(logger, null);
|
public static void InitializationStarted(ILogger logger) => _initializationStarted(logger, null);
|
||||||
public static void InitializationSucceeded(ILogger logger) => _intializationSucceded(logger, null);
|
public static void InitializationSucceeded(ILogger logger) => _initializationSucceded(logger, null);
|
||||||
public static void InitializationFailed(ILogger logger, Exception exception) => _intializationFailed(logger, exception);
|
public static void InitializationFailed(ILogger logger, Exception exception) => _initializationFailed(logger, exception);
|
||||||
public static void DisposeStarted(ILogger logger, CircuitId circuitId) => _disposeStarted(logger, circuitId, null);
|
public static void DisposeStarted(ILogger logger, CircuitId circuitId) => _disposeStarted(logger, circuitId, null);
|
||||||
public static void DisposeSucceeded(ILogger logger, CircuitId circuitId) => _disposeSucceded(logger, circuitId, null);
|
public static void DisposeSucceeded(ILogger logger, CircuitId circuitId) => _disposeSucceeded(logger, circuitId, null);
|
||||||
public static void DisposeFailed(ILogger logger, CircuitId circuitId, Exception exception) => _disposeFailed(logger, circuitId, exception);
|
public static void DisposeFailed(ILogger logger, CircuitId circuitId, Exception exception) => _disposeFailed(logger, circuitId, exception);
|
||||||
public static void CircuitOpened(ILogger logger, CircuitId circuitId) => _onCircuitOpened(logger, circuitId, null);
|
public static void CircuitOpened(ILogger logger, CircuitId circuitId) => _onCircuitOpened(logger, circuitId, null);
|
||||||
public static void ConnectionUp(ILogger logger, CircuitId circuitId, string connectionId) => _onConnectionUp(logger, circuitId, connectionId, null);
|
public static void ConnectionUp(ILogger logger, CircuitId circuitId, string connectionId) => _onConnectionUp(logger, circuitId, connectionId, null);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
/// the <see cref="CircuitClientProxy"/> to use the new client instance that attempted to reconnect to the server. Removing the entry from
|
/// the <see cref="CircuitClientProxy"/> to use the new client instance that attempted to reconnect to the server. Removing the entry from
|
||||||
/// <see cref="DisconnectedCircuits"/> should ensure we no longer have to concern ourselves with entry expiration.
|
/// <see cref="DisconnectedCircuits"/> should ensure we no longer have to concern ourselves with entry expiration.
|
||||||
///
|
///
|
||||||
/// Knowing when a client disconnected is not an exact science. There's a fair possiblity that a client may reconnect before the server realizes.
|
/// Knowing when a client disconnected is not an exact science. There's a fair possibility that a client may reconnect before the server realizes.
|
||||||
/// Consequently, we have to account for reconnects and disconnects occuring simultaneously as well as appearing out of order.
|
/// Consequently, we have to account for reconnects and disconnects occuring simultaneously as well as appearing out of order.
|
||||||
/// To manage this, we use a critical section to manage all state transitions.
|
/// To manage this, we use a critical section to manage all state transitions.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
@ -99,7 +99,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// DisconnectCore may fail to disconnect the circuit if it was previously marked inactive or
|
// DisconnectCore may fail to disconnect the circuit if it was previously marked inactive or
|
||||||
// has been transfered to a new connection. Do not invoke the circuit handlers in this instance.
|
// has been transferred to a new connection. Do not invoke the circuit handlers in this instance.
|
||||||
|
|
||||||
// We have to do in this instance.
|
// We have to do in this instance.
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
@ -181,7 +181,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
{
|
{
|
||||||
// Transition the host from disconnected to connected if it's available. In this critical section, we return
|
// Transition the host from disconnected to connected if it's available. In this critical section, we return
|
||||||
// an existing host if it's currently considered connected or transition a disconnected host to connected.
|
// an existing host if it's currently considered connected or transition a disconnected host to connected.
|
||||||
// Transfering also wires up the client to the new set.
|
// Transferring also wires up the client to the new set.
|
||||||
(circuitHost, previouslyConnected) = ConnectCore(circuitId, clientProxy, connectionId);
|
(circuitHost, previouslyConnected) = ConnectCore(circuitId, clientProxy, connectionId);
|
||||||
|
|
||||||
if (circuitHost == null)
|
if (circuitHost == null)
|
||||||
|
|
@ -428,7 +428,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
_connectingToDisconnectedCircuit = LoggerMessage.Define<CircuitId, string>(
|
_connectingToDisconnectedCircuit = LoggerMessage.Define<CircuitId, string>(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
EventIds.ConnectingToDisconnectedCircuit,
|
EventIds.ConnectingToDisconnectedCircuit,
|
||||||
"Transfering disconnected circuit {CircuitId} to connection {ConnectionId}.");
|
"Transferring disconnected circuit {CircuitId} to connection {ConnectionId}.");
|
||||||
|
|
||||||
_failedToReconnectToCircuit = LoggerMessage.Define<CircuitId>(
|
_failedToReconnectToCircuit = LoggerMessage.Define<CircuitId>(
|
||||||
LogLevel.Debug,
|
LogLevel.Debug,
|
||||||
|
|
|
||||||
|
|
@ -72,14 +72,14 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
// as we have a client that is not acknowledging render batches fast enough (something we consider needs
|
// as we have a client that is not acknowledging render batches fast enough (something we consider needs
|
||||||
// to be fast).
|
// to be fast).
|
||||||
// The result is something as follows:
|
// The result is something as follows:
|
||||||
// Lets imagine an extreme case where the server produces a new batch every milisecond.
|
// Lets imagine an extreme case where the server produces a new batch every millisecond.
|
||||||
// Lets say the client is able to ACK a batch every 100 miliseconds.
|
// Lets say the client is able to ACK a batch every 100 milliseconds.
|
||||||
// When the app starts the client might see the sequence 0->(MaxUnacknowledgedRenderBatches-1) and then
|
// When the app starts the client might see the sequence 0->(MaxUnacknowledgedRenderBatches-1) and then
|
||||||
// after 100 miliseconds it sees it jump to 1xx, then to 2xx where xx is something between {0..99} the
|
// after 100 milliseconds it sees it jump to 1xx, then to 2xx where xx is something between {0..99} the
|
||||||
// reason for this is that the server slows down rendering new batches to as fast as the client can consume
|
// reason for this is that the server slows down rendering new batches to as fast as the client can consume
|
||||||
// them.
|
// them.
|
||||||
// Similarly, if a client were to send events at a faster pace than the server can consume them, the server
|
// Similarly, if a client were to send events at a faster pace than the server can consume them, the server
|
||||||
// would still proces the events, but would not produce new renders until it gets an ack that frees up space
|
// would still process the events, but would not produce new renders until it gets an ack that frees up space
|
||||||
// for a new render.
|
// for a new render.
|
||||||
// We should never see UnacknowledgedRenderBatches.Count > _options.MaxBufferedUnacknowledgedRenderBatches
|
// We should never see UnacknowledgedRenderBatches.Count > _options.MaxBufferedUnacknowledgedRenderBatches
|
||||||
|
|
||||||
|
|
@ -184,7 +184,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
{
|
{
|
||||||
// Send the render batch to the client
|
// Send the render batch to the client
|
||||||
// If the "send" operation fails (synchronously or asynchronously) or the client
|
// If the "send" operation fails (synchronously or asynchronously) or the client
|
||||||
// gets disconected simply give up. This likely means that
|
// gets disconnected simply give up. This likely means that
|
||||||
// the circuit went offline while sending the data, so simply wait until the
|
// the circuit went offline while sending the data, so simply wait until the
|
||||||
// client reconnects back or the circuit gets evicted because it stayed
|
// client reconnects back or the circuit gets evicted because it stayed
|
||||||
// disconnected for too long.
|
// disconnected for too long.
|
||||||
|
|
@ -229,7 +229,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
// from the client that it has received and successfully applied all batches up to that point).
|
// from the client that it has received and successfully applied all batches up to that point).
|
||||||
|
|
||||||
// If receive an ack for a previously acknowledged batch, its an error, as the messages are
|
// If receive an ack for a previously acknowledged batch, its an error, as the messages are
|
||||||
// guranteed to be delivered in order, so a message for a render batch of 2 will never arrive
|
// guaranteed to be delivered in order, so a message for a render batch of 2 will never arrive
|
||||||
// after a message for a render batch for 3.
|
// after a message for a render batch for 3.
|
||||||
// If that were to be the case, it would just be enough to relax the checks here and simply skip
|
// If that were to be the case, it would just be enough to relax the checks here and simply skip
|
||||||
// the message.
|
// the message.
|
||||||
|
|
@ -264,7 +264,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
|
|
||||||
if (lastBatchId < incomingBatchId)
|
if (lastBatchId < incomingBatchId)
|
||||||
{
|
{
|
||||||
// This exception is due to a bad client input, so we mark it as such to prevent loging it as a warning and
|
// This exception is due to a bad client input, so we mark it as such to prevent logging it as a warning and
|
||||||
// flooding the logs with warnings.
|
// flooding the logs with warnings.
|
||||||
throw new InvalidOperationException($"Received an acknowledgement for batch with id '{incomingBatchId}' when the last batch produced was '{lastBatchId}'.");
|
throw new InvalidOperationException($"Received an acknowledgement for batch with id '{incomingBatchId}' when the last batch produced was '{lastBatchId}'.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void CreateCircuitId_Generates_GeneratesDifferentIds_ForSuccesiveCalls()
|
public void CreateCircuitId_Generates_GeneratesDifferentIds_ForSuccessiveCalls()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var factory = TestCircuitIdFactory.CreateTestFactory();
|
var factory = TestCircuitIdFactory.CreateTestFactory();
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(new long[] { 2, 3, 4 }, renderIds);
|
Assert.Equal(new long[] { 2, 3, 4 }, renderIds);
|
||||||
Assert.True(task.Wait(3000), "One or more render batches werent acknowledged");
|
Assert.True(task.Wait(3000), "One or more render batches weren't acknowledged");
|
||||||
|
|
||||||
await task;
|
await task;
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +233,7 @@ namespace Microsoft.AspNetCore.Components.Web.Rendering
|
||||||
exceptions.Add(e);
|
exceptions.Add(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Receive the ack for the intial batch
|
// Receive the ack for the initial batch
|
||||||
_ = renderer.OnRenderCompletedAsync(2, null);
|
_ = renderer.OnRenderCompletedAsync(2, null);
|
||||||
// Receive the ack for the second batch
|
// Receive the ack for the second batch
|
||||||
_ = renderer.OnRenderCompletedAsync(3, null);
|
_ = renderer.OnRenderCompletedAsync(3, null);
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,9 @@ namespace Microsoft.AspNetCore.Components.Server.Tests
|
||||||
services.AddServerSideBlazor();
|
services.AddServerSideBlazor();
|
||||||
services.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build());
|
services.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build());
|
||||||
|
|
||||||
var serviceProvder = services.BuildServiceProvider();
|
var serviceProvider = services.BuildServiceProvider();
|
||||||
|
|
||||||
return new ApplicationBuilder(serviceProvder);
|
return new ApplicationBuilder(serviceProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyComponent : IComponent
|
private class MyComponent : IComponent
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Components
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new JsonException($"Unexcepted JSON Token {reader.TokenType}.");
|
throw new JsonException($"Unexpected JSON Token {reader.TokenType}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ namespace Microsoft.AspNetCore.Components.Forms
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Formats the value as a string. Derived classes can override this to determine the formating used for <see cref="CurrentValueAsString"/>.
|
/// Formats the value as a string. Derived classes can override this to determine the formatting used for <see cref="CurrentValueAsString"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value to format.</param>
|
/// <param name="value">The value to format.</param>
|
||||||
/// <returns>A string representation of the value.</returns>
|
/// <returns>A string representation of the value.</returns>
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ namespace Microsoft.AspNetCore.Components.Forms
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Formats the value as a string. Derived classes can override this to determine the formating used for <c>CurrentValueAsString</c>.
|
/// Formats the value as a string. Derived classes can override this to determine the formatting used for <c>CurrentValueAsString</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value to format.</param>
|
/// <param name="value">The value to format.</param>
|
||||||
/// <returns>A string representation of the value.</returns>
|
/// <returns>A string representation of the value.</returns>
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ namespace Microsoft.AspNetCore.Components.Forms
|
||||||
};
|
};
|
||||||
var fieldIdentifier = FieldIdentifier.Create(() => model.StringProperty);
|
var fieldIdentifier = FieldIdentifier.Create(() => model.StringProperty);
|
||||||
|
|
||||||
// Act/Assert: Initally, it's valid and unmodified
|
// Act/Assert: Initially, it's valid and unmodified
|
||||||
var inputComponent = await RenderAndGetTestInputComponentAsync(rootComponent);
|
var inputComponent = await RenderAndGetTestInputComponentAsync(rootComponent);
|
||||||
Assert.Equal("valid", inputComponent.CssClass); // no Class was specified
|
Assert.Equal("valid", inputComponent.CssClass); // no Class was specified
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("en-US")]
|
[InlineData("en-US")]
|
||||||
[InlineData("fr-FR")]
|
[InlineData("fr-FR")]
|
||||||
public void CanSetCultureAndParseCultueSensitiveNumbersAndDates(string culture)
|
public void CanSetCultureAndParseCultureSensitiveNumbersAndDates(string culture)
|
||||||
{
|
{
|
||||||
var cultureInfo = CultureInfo.GetCultureInfo(culture);
|
var cultureInfo = CultureInfo.GetCultureInfo(culture);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<p id="errormessage-failure">Error = @errorFailure</p>
|
<p id="errormessage-failure">Error = @errorFailure</p>
|
||||||
|
|
||||||
<button id="triggerjsinterop-malformed" @onclick="@TriggerJSInterop">Trigger malformed JS interop callback</button>
|
<button id="triggerjsinterop-malformed" @onclick="@TriggerJSInterop">Trigger malformed JS interop callback</button>
|
||||||
<button id="triggerjsinterop-success" @onclick="@TriggerJSInteropSuccess">Trigger successfull JS interop callback</button>
|
<button id="triggerjsinterop-success" @onclick="@TriggerJSInteropSuccess">Trigger successful JS interop callback</button>
|
||||||
<button id="triggerjsinterop-failure" @onclick="@TriggerJSInteropFailure">Trigger error JS interop callback</button>
|
<button id="triggerjsinterop-failure" @onclick="@TriggerJSInteropFailure">Trigger error JS interop callback</button>
|
||||||
|
|
||||||
<button id="event-handler-throw-sync" @onclick="@TriggerSyncException">Trigger sync exception</button>
|
<button id="event-handler-throw-sync" @onclick="@TriggerSyncException">Trigger sync exception</button>
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ namespace Microsoft.AspNetCore.E2ETesting
|
||||||
// To prevent this we let the client attempt several times to connect to the server, increasing
|
// To prevent this we let the client attempt several times to connect to the server, increasing
|
||||||
// the max allowed timeout for a command on each attempt linearly.
|
// the max allowed timeout for a command on each attempt linearly.
|
||||||
// This can also be caused if many tests are running concurrently, we might want to manage
|
// This can also be caused if many tests are running concurrently, we might want to manage
|
||||||
// chrome and chromedriver instances more aggresively if we have to.
|
// chrome and chromedriver instances more aggressively if we have to.
|
||||||
// Additionally, if we think the selenium server has become irresponsive, we could spin up
|
// Additionally, if we think the selenium server has become irresponsive, we could spin up
|
||||||
// replace the current selenium server instance and let a new instance take over for the
|
// replace the current selenium server instance and let a new instance take over for the
|
||||||
// remaining tests.
|
// remaining tests.
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ Captured output lines:
|
||||||
|
|
||||||
private static Process StartSentinelProcess(Process process, string sentinelFile, int timeout)
|
private static Process StartSentinelProcess(Process process, string sentinelFile, int timeout)
|
||||||
{
|
{
|
||||||
// This sentinel process will start and will kill any roge selenium server that want' torn down
|
// This sentinel process will start and will kill any rouge selenium server that want' torn down
|
||||||
// via normal means.
|
// via normal means.
|
||||||
var psi = new ProcessStartInfo
|
var psi = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue