-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Error boundaries #30874
Error boundaries #30874
Conversation
c4ac7f3
to
a40aed7
Compare
…efore we notify them. Also think about infinite error loops.
a40aed7
to
bf04cf3
Compare
/// The maximum number of errors that can be handled. If more errors are received, | ||
/// they will be treated as fatal. Calling <see cref="Recover"/> resets the count. | ||
/// </summary> | ||
[Parameter] public int MaximumErrorCount { get; set; } = 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this to be public if we're only using it to determine whether logic in ErrorContent
is causing an infinite stream of exceptions? It's not clear to me why we would want users to be able to customize it if we can set a sensible default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's certainly open for debate. A developer might, for example, have a list with 101 items and want to be able to tolerate the case where every item fails independently, so they might have a reason to increase this number.
The tradeoff with bigger values is that there's more processing and more log messages generated before we eventually stop the process. I'm not sure there would be a single value that would be ideal for all cases.
|
||
namespace Microsoft.AspNetCore.Components | ||
{ | ||
// Purpose of this interface, instead of just using ErrorBoundaryBase directly: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the code comments you've added here and elsewhere. Good stuff!
// This should not be called from anywhere except SetDirectParameters or NotifyCascadingValueChanged. | ||
// Those two methods know how to correctly combine both cascading and non-cascading parameters to supply | ||
// a consistent set to the recipient. | ||
private void SupplyCombinedParameters(ParameterView directAndCascadingParameters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change related to the error boundaries work or general goodness?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to bring the "normal params" and "cascaded params" code paths into a common place so they can share the same interactions with error boundaries (the call to AddToPendingTasks
which supplies an owningComponentState
, which in turn determines how we route to the correct error boundary).
// whether DetailedErrors is enabled and whether you're in production, because even on WebAssembly | ||
// you likely don't want to put technical data like that in the UI for end users. A reasonable way | ||
// to toggle this is via something like "#if DEBUG" but that can only be done in user code. | ||
// [2] We can't have any other human-readable content by default, because it would need to be valid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is some initial feedback
{ | ||
if (ThrowOnParametersSetAsync) | ||
{ | ||
await Task.Delay(500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Task.Yield should suffice here, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to guarantee that next render goes through and into the DOM before the .NET side continues, even to the extent that it's observable to a human (who is paying close attention) when running the scenario manually in their browser. This eliminates any unclarity about the order of operations within the test, versus having to reason about the exact order in which they were queued.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough
@@ -4170,6 +4170,241 @@ public async Task ThrowsIfComponentProducesInvalidRenderTree() | |||
Assert.StartsWith($"Render output is invalid for component of type '{typeof(TestComponent).FullName}'. A frame of type 'Element' was left unclosed.", ex.Message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the future: We should break this file into more than one class. It has 5K lines and it's easily dismissed in CRs and hard to maintain review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
var message = _options.DetailedErrors | ||
? exception.ToString() | ||
: $"For more details turn on detailed exceptions in '{nameof(CircuitOptions)}.{nameof(CircuitOptions.DetailedErrors)}'"; | ||
return _jsRuntime.InvokeVoidAsync("console.error", message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this do
private static Task NotifyClientError(IClientProxy client, string error) => client.SendAsync("JS.Error", error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, JS.Error
is for fatal exceptions (it shows the yellow bar of death). We could add a whole new message name for nonfatal errors, but I didn't see any reason to do so, since console.error
already has exactly the desired behavior and is all that our new handler would call anyway.
We're always free to change how this message gets passed to JS in the future if a reason emerges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
protected override async Task OnErrorAsync(Exception exception) | ||
{ | ||
await ErrorBoundaryLogger!.LogErrorAsync(exception); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should reconsider this and make it synchronous. Making it asynchronous introduces an unnecessary level of complexity and I can't think of scenarios in which this is useful, we do fire and forget for logging in other places and it should be doable here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a pros and cons thing. I did start with synchronous only, but switched to allow async because:
- The total amount of implementation complexity this adds for us is pretty modest (it's these lines)
- If we can make it easier for a developer to do async logging right, why wouldn't we? If we don't do it, we're just pushing the responsibility across to developers, who might not have a good sense of how to cause async errors to show up anywhere.
- If people don't need async, it's very easy for them to do sync-only operations within this. Whereas the inverse is not true. And if we eventually had to have both
OnError
andOnErrorAsync
, that's certainly more conceptual weight.
If you feel really strongly please say so, otherwise I'd err on the side of being flexible for developers here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- And if we eventually had to have both
OnError
andOnErrorAsync
, that's certainly more conceptual weight.
That's the main reason I can think of, however for me the drawback is having to think about async errors that might happen within the errorboundary OnErrorAsync
I don't feel strongly about it, I just thought it was worth a conversation.
// for all languages. | ||
// Instead, the default project template provides locale-specific default content via CSS. This provides | ||
// a quick form of customization even without having to subclass this component. | ||
builder.OpenElement(2, "div"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would a developer need to do to make this accessible? (Since we don't put any content)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do add content by default in the project template via CSS. I would expect screen readers to honour that in the same way they read out any other text displayed in the document.
If an application has more requirements than that, they need to either supply ErrorContent
or subclass ErrorBoundary
.
@@ -28,6 +29,7 @@ public abstract partial class Renderer : IDisposable, IAsyncDisposable | |||
{ | |||
private readonly IServiceProvider _serviceProvider; | |||
private readonly Dictionary<int, ComponentState> _componentStateById = new Dictionary<int, ComponentState>(); | |||
private readonly Dictionary<IComponent, ComponentState> _componentStateByComponent = new Dictionary<IComponent, ComponentState>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand this dictionary is to facilitate the look up in the DispatchEventAsync and so on.
Would iterating over the ComponentState entries instead work?
The reason I'm bringing this up is because it implies more allocation and housekeeping we need to perform whether an exception happens or not, and by the time an exception happens (by definition) we are already in an "exceptional" state, so we shouldn't care about perf in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From inspection this is only used in the event handler, so I think it might be better to avoid this dictionary all together and just iterate over the list of component state entries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately that's not the case. We have to find the component state before beginning event dispatch in case it got disposed before the event handler completed, so we need to do this lookup on every incoming event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, I see. Is it because of the async case where the error boundary might get disposed before the exception happens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, or if the receiver component gets disposed before its event handler raises an async exception, which is potentially pretty common (e.g., it happens every time if you have multiple children and more than one have async operations that fail, because the first error will cause the disposal of both, then the second error gets received).
// infinite error loop. Unfortunately it's very hard to distinguish whether the error source is "child content" | ||
// or "error content", since the exceptions can be received asynchronously, arbitrarily long after we switched | ||
// between normal and errored states. Without creating a very intricate coupling between ErrorBoundaryBase and | ||
// Renderer internals, the obvious options are either: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could "easily" determine this within the renderer and pass that info to the handler, isn't it?
The callsite for HandleException knows the handler and the source, so it can just compare them for reference equality and pass that information to handle exception (I think that's likely useful).
If we were todo that, then do we still need a limit on the number of exceptions? We could choose to say something like:
- If the exception is not within the ErrorBoundary component handle it, otherwise throw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not at all easy, as far as I know.
If the exception is not within the ErrorBoundary component handle it, otherwise throw?
Two counterexamples:
- If the ErrorBoundary is not yet in an errored state (or has recovered), then the exceptions will be within it, and should not be fatal, so that would be a false positive
- Even if the exception appears not to be from within the ErrorBoundary, that might be because some intermediate child has since been disposed, and in that case it might still be from the error content, so that would be a false negative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I don't have a deep enough intuition about this, so I'll trust your judgment (and the tests) here.
.GetComponentFrames<ErrorThrowingComponent>().Single().ComponentId; | ||
|
||
// Act/Assert 1: No synchronous errors | ||
exception = new InvalidTimeZoneException("Error during SetParametersAsync"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to have a comment here explaining that ErrorThrowingComponent doesn't throw if the exception is not set. It took me a while to understand the test.
builder.OpenElement(s++, "p"); | ||
builder.AddContent(s++, n); | ||
builder.OpenElement(0, "p"); | ||
builder.AddContent(1, n); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks much cleaner!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks superb! Pretty solid changes.
Other than small pieces of feedback, it looks great!
* Update dependencies from https://github.com/dotnet/efcore build 20210315.3 (dotnet#30960) [main] Update dependencies from dotnet/efcore * Feedback from Pranav * Remove regex use in DataProtection (dotnet#30855) * Fix null ref in SyntaxTokenCache (dotnet#30978) Fixes dotnet#27154 * Pool SocketSenders (dotnet#30771) - SocketAsyncEventArgs have lots of state on them and as a result are quite big (~350) bytes at runtime. We can pool these since sends are usually very fast and we can reduce the per connection overhead as a result. - We also allocate one per IOQueue to reduce contention. - Fixed buffer list management - Disposed pool when the transport is disposed - Added project to slnf so running tests in VS was possible - Clear the buffer and buffer list before returning to the pool - This cleans up dumps as the pooled senders don't see references to buffers while pooled in the queue - Keep track of items in the pool separately from the queue count. * Add Consolidated view classifier to make view types internal (dotnet#30976) * Add Consolidated view classifier to make view types internal * Address feedback from peer review * Address feedback and fix tests * Fix nullability of TypeNameHelper.GetTypeDisplayName parameter (dotnet#30987) * [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#30968) [main] Update dependencies from dotnet/runtime dotnet/efcore - Remove assemblies from the ref and runtime pack - Remove more references * Update src/Features/JsonPatch/src/Internal/ConversionResultProvider.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update src/Features/JsonPatch/src/PublicAPI.Unshipped.txt Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update dependencies from https://github.com/dotnet/efcore build 20210316.2 (dotnet#30991) [main] Update dependencies from dotnet/efcore * HTTP/3 input validation and connection abort (dotnet#29665) * Connection error for invalid HTTP/3 frame on request stream * Update src/Servers/Kestrel/Core/src/CoreStrings.resx * Write frame types and errors codes in logs as per spec * Clean up * Add HTTP/3 connection exception with code * Connection abort * More abort connection stuff * More test * More tests * PR feedback * Update dependencies from https://github.com/dotnet/efcore build 20210317.1 (dotnet#30998) [main] Update dependencies from dotnet/efcore * helix + pw + linux/osx (dotnet#30676) * [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#30999) [main] Update dependencies from dotnet/runtime dotnet/efcore * Dispose streams that don't fit in pool (dotnet#30995) * Dispose streams that don't fit in pool * PR feedback * Update NodeJS dependency in build instructions (dotnet#31000) * Respect consolidated views in all document classifiers (dotnet#31008) * Respect consolidated views in all document classifiers * Address feedback from peer review * E2E test apps for WinForms and WPF BlazorWebView (dotnet#31021) * Add API to Renderer to trigger a UI refresh on hot reload (dotnet#30884) * Add API to Renderer to trigger a UI refresh on hot reload Fixes dotnet#30816 * Update RazorExtensions.cs (dotnet#31029) * Fix credscan issues in aspnetcore (dotnet#30337) * Fix credscan issues in DataProtection * Fix credscan issues in Identity, except where they affect checked in certs * Updated scan * [Blazor] Adds static web assets support for Blazor desktop (dotnet#31041) * Wires up static web assets support on the WebViewManager. * Support ElementReference.Focus in WebView (dotnet#31050) * Support InputFile in WebView (dotnet#31049) * Update DotNetMuxerTest (dotnet#31053) Fixes dotnet#24082 * Bring back working DevServer packaging setup (dotnet#31043) * Bring pack working DevServer packaging setup * Revert "Bring pack working DevServer packaging setup" This reverts commit 0dda92e. * Update runtimeconfig.template.json * Quarantine one failing test (dotnet#31045) - dotnet#31044 - `RazorPagesTemplate_RazorRuntimeCompilation_BuildsAndPublishes()` * Update SDK to bring unified assembly changes (dotnet#31039) * Update SDK to bring unified assembly changes * Update SDK to pick up Razor pages fix * Fixup test Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update launchSettings to indicate hotReload is to be used (dotnet#31060) * Fix race in FrameAfterTrailers_UnexpectedFrameError dotnet#30754 (dotnet#31061) * Fix JS interop cases in WebView (dotnet#31054) * Template tests: Create dev cert only once (dotnet#31012) * Simplify Razor bug reports. (dotnet#31033) * Simplify Razor bug reports. - We now have better mechanisms for capturing information so no need to scare users off. * Address code review feedback * [Blazor][Desktop] Mark packages as shipping (dotnet#31035) * Make packages shipping * Update RepoTasks to msbuild 16.9 * Update global.json * Update Nuget * Remove WebView dependency to AspNetCore.App (dotnet#31071) The Blazor Desktop project must not depend on Microsoft.AspNetCore.App because it needs to run on almost any platform, including Android/iOS. But AspNetCore.App doesn't run on those platforms. This changes WebView to not use any packages that are part of AspNetCore.App, such as StaticFiles and Http.Abstractions. Instead, it has copies of those files. * Use longer delay in test (dotnet#31072) * [SignalR TS] Fix permanent Disconnecting state (dotnet#30948) * Changed logLevel to Information instead of warning for EphemeralDataProtectionProvider (dotnet#29405) Fixes dotnet#29107 * [Blazor][Desktop] Fixes nullable annotations on the public API baselines (dotnet#31073) * Fix nullable annotations * Fix APIs * Add missing API baseline file * Implements shadow copying for ASP.NET Core + IIS (dotnet#28357) * Suppress generating source checksums when configured (dotnet#31089) Hot reload / EnC does not like it when type level attributes are modified. Razor views and Pages include a RazorSourceChecksumAttribute that includes a checksum of all of it's inputs (current cshtml file, and all _ViewImports that contribute to it). It's used used by runtime compilation to tell if the compiled view is current compared to it's inputs. However, it gets in the way with enc since editing a file updates the checksum. We'll disable this feature by default in RazorSourceGenerator, and enable it using an MSBuild switch that's configured by runtime compilation * Caching Redis: Add option to register profiling session (dotnet#31018) * Add option to register profiling session * Add API change * Fix public API declaration * Cleanup * Quarantine and fix RequestTrailers_CanReadTrailersFromRequest dotnet#31057 (dotnet#31059) * Sync shared code from runtime (dotnet#31094) Co-authored-by: Tratcher <Tratcher@users.noreply.github.com> * Revert "Remove ANCM shim and outofprocess handler from Runtime SiteEx… (dotnet#31042) * Revert "Remove ANCM shim and outofprocess handler from Runtime SiteExtension (dotnet#24884)" This reverts commit 7f7528f. * Enable site extension build temporarily * Enable build native * Fixing site extension build * No need to set * Fixing up build * Update .azure/pipelines/ci.yml * Update ci.yml * retry * Update .azure/pipelines/ci.yml * Follow ups for Blazor AOT (dotnet#31098) * Follow ups for Blazor AOT * Add Emscripten packs to manifest * Update acquire tool to use manifest from the dotnet sdk * Add AOT option to templates * Undo Emscripten for now * [Blazor] [Desktop] Exclude Resources.resx from the embedded file manifest (dotnet#31107) Excludes unnecessary embedded resources from the embedded files manifest provider. * Fix some low hanging allocation fruit (dotnet#31115) * Fix some low hanging allocation fruit - Use singleton pipe options - Use Task.Yield instead of AwaitableThreadPool on the server side - Change WebSocketMiddleware handshake helpers to remove enumerator allocations. * Fix issues preventing hot reload for Blazor WASM (dotnet#31108) * Configure DOTNET_MODIFIABLE_ASSEMBLIES=debug env variable * Fixup broken reflection * Fixup targeting pack intermediate zip version * Add new Polly DI extension method for HttpClientFactory (dotnet#28283) * Fix IDE warnings Fix IDE warnings about non-disposed handlers. * Update return type documentation Update the comment's type to match the method's. * Add new AddPolicyRegistry overload Add a new overload for AddPolicyRegistry() that allows the caller to configure the policy registry using other services that are registered with the service provider, such as config. * Add more nullability to Mvc.Core (dotnet#31076) * Update nuget & msbuild versions (dotnet#31064) * Update nuget & msbuild versions * Update RepoTasks.csproj * Fix one test * Fix all tests * Update dependencies from https://github.com/dotnet/arcade build 20210317.3 (dotnet#31124) Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 6.0.0-beta.21160.7 -> To Version 6.0.0-beta.21167.3 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * Update branding to 6.0.0-preview4 * Revert "Update branding to 6.0.0-preview4" This reverts commit 5c8e9f1. * Added missing event ids for hosting events (dotnet#31149) - Fixed slnf file * Don't separately build arm64 installers * Don't build targeting pack nupkgs * Undo change that stopped building installers in win-arm64 leg. This reverts commit 03aab5d. * Update comment * Update branding to 6.0.0-preview4 (dotnet#31153) * Dispose the DiagnosticListener (dotnet#31170) - Add the DiagnosticListener to the DI container as a lambda so it gets disposed. * Add support for tabs vs. spaces settings for generated files * Fixed grammar on `SessionOptions.IOTimeout` XML (dotnet#31174) Fixed grammar on `SessionOptions.IOTimeout` * Resolve remaining credscan bugs (dotnet#31157) * Default to Kestrel over IISExpress (dotnet#31161) * Update CONTRIBUTING.md (dotnet#31167) * Update CONTRIBUTING.md * Follow-up edits * Add tracing to templates process launch for debugging (dotnet#31202) * Add tests * Cleanup * Cleanup * Remove unsafe from BytesOrdinalEqualsStringAndAscii (dotnet#31201) * Add field * Cleanup * Revert changes to global.json * fix naming * Add hotReloadProfile to Razor Pages template (dotnet#31197) * BlazorTemplate test improvements (dotnet#30907) * Split the HPackEncoder partial class (dotnet#31210) * [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#31020) [main] Update dependencies from dotnet/runtime dotnet/efcore - Do not declare iOS and Android support everywhere - runtime update includes new annotations making non-support obvious - see dotnet/runtime#49354 (w/ a similar Android PR coming soon) - !fixup! Fix typo in item group name - !fixup! Set `$(RemoveDevicePlatformSupport)` in correct project - not needed in BlazorManifest.csproj - but, is needed in dotnet-install-blazoraot.csproj - suppress - Fixup * Annotate Blazor wasm auth assemblies for trimmability (dotnet#31119) Minor cleanup when inspecting the code * Creates script command for sql-cache-tool (dotnet#30398) * Creates script command for sql-cache-tool * Includes idempotency, output to stdout, or specific file * Fixes help suggestion to be command-specific * Corrects typo * Revert "BlazorTemplate test improvements (dotnet#30907)" (dotnet#31223) This reverts commit 730e39b. * Sync shared code from runtime (dotnet#31182) Co-authored-by: dotnet <dotnet@users.noreply.github.com> * Unquarantine BootResourceCachingTest (dotnet#31154) * Resolve final credscan bug (dotnet#31196) * READMEs for Servers (dotnet#31207) * READMEs for Servers * Remove en-us * Update src/Servers/README.md Co-authored-by: Brennan <brecon@microsoft.com> * Update src/Servers/Kestrel/README.md Co-authored-by: Chris Ross <Tratcher@Outlook.com> * Update src/Servers/IIS/README.md Co-authored-by: Chris Ross <Tratcher@Outlook.com> * Feedback * Update src/Servers/HttpSys/README.md * Quick test * HttpSys * Update README.md * Feedback * Update src/Servers/IIS/README.md Co-authored-by: Günther Foidl <gue@korporal.at> * Update src/Servers/Kestrel/README.md Co-authored-by: Günther Foidl <gue@korporal.at> Co-authored-by: Brennan <brecon@microsoft.com> Co-authored-by: Chris Ross <Tratcher@Outlook.com> Co-authored-by: Günther Foidl <gue@korporal.at> * Components test parole for good behavior (dotnet#31156) * Add hotReloadProfile to Razor Pages template (dotnet#31216) * Add hotReloadProfile to Razor Pages template * Turn off hotReloadProfile for Blazor WebAssembly projects The WebAssembly experience is a bit problematic in preview3 because of runtime issues dotnet/runtime#50190. We'll turn it off in the templates by default to avoid giving a confusing experience out of the box. * [main] Update dependencies from dotnet/efcore dotnet/runtime (dotnet#31220) [main] Update dependencies from dotnet/efcore dotnet/runtime * Readmes for HTTP and Site Extensions (dotnet#31250) * Readmes for HTTP and Site Extensions * Apply suggestions from code review Co-authored-by: Brennan <brecon@microsoft.com> Co-authored-by: Brennan <brecon@microsoft.com> * Update dependencies from https://github.com/dotnet/efcore build 20210325.2 (dotnet#31254) [main] Update dependencies from dotnet/efcore * Refactor and fix failing tests * Revert global.json changes * Enable CA2012 (Use ValueTask Correctly) (dotnet#31221) * Unquarantine a couple servers tests (dotnet#31213) * Update src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriter.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Sync shared code from runtime (dotnet#31271) Co-authored-by: Tratcher <Tratcher@users.noreply.github.com> * Update dependencies from https://github.com/dotnet/runtime build 20210326.1 (dotnet#31277) [main] Update dependencies from dotnet/runtime * Use Emscripten SDKs in WASM workload (dotnet#31259) * Update dependencies from https://github.com/dotnet/efcore build 20210326.1 (dotnet#31283) [main] Update dependencies from dotnet/efcore * Clean up verbiage on build scripts (dotnet#31262) * Clean up verbiage on build scripts * Update docs/BuildFromSource.md Co-authored-by: Kevin Pilch <kevinpi@microsoft.com> Co-authored-by: Kevin Pilch <kevinpi@microsoft.com> * Enable nullable on more authentication projects (dotnet#31230) * Enable nullable on Azure projects (dotnet#31298) * Reduce allocations for Cookies. (dotnet#31258) * Update dependencies from https://github.com/dotnet/efcore build 20210326.2 (dotnet#31292) [main] Update dependencies from dotnet/efcore * [release/6.0-preview3] Update dependencies from dotnet/efcore dotnet/runtime (dotnet#31255) [release/6.0-preview3] Update dependencies from dotnet/efcore dotnet/runtime - Port changes from main - Merge branch 'release/6.0-preview3' into darc-release/6.0-preview3-ce4fb228-ea32-4f60-95e1-0e60d42e3fc3 * [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#31310) [main] Update dependencies from dotnet/runtime dotnet/efcore * Update dependencies from https://github.com/dotnet/runtime build 20210327.4 (dotnet#31329) [main] Update dependencies from dotnet/runtime * Fix comment grammar (dotnet#31326) Minor update to XML docs to fix sentence grammar. * Use LoggerMessage.Define in HttpSys (dotnet#31333) - Use LoggerMessage.Define() throughout HttpSys instead of ILogger extension methods. - Also updates two incorrect event Id field names. Fixes dotnet#31313. * Reduce the per connection overhead in SocketConnection (dotnet#31308) * Reduce the per connection overhead in SocketConnection - Removed 3 state machines (StartAsync, ProcessSends and ProcessReceives) - Use ValueTask to remove delegate allocation on both senders and receivers - Remove field from DoSend and DoReceive state machine * Faster strongly typed features for server FeatureCollection (dotnet#31322) - Use strongly typed features - Use Unsafe.As to workaround dotnet/runtime#49614 - Do the casting it for Set<T> as well - Add more benchmarks - Reorder features (order of reset); * Update dependencies from https://github.com/dotnet/runtime build 20210328.6 (dotnet#31350) [main] Update dependencies from dotnet/runtime * Move logging to separate class to prevent allocation per generic type (dotnet#31345) * Badges, badges! (Licence, Help wanted, Good first issue, Chat) (dotnet#31341) * Badges, badges! (Licence, Help wanted, Good first issue, Chat) * Use correct links * Update dependencies from https://github.com/dotnet/efcore build 20210329.1 (dotnet#31351) [main] Update dependencies from dotnet/efcore * Fix WebView header APIs and behavior (dotnet#31246) * Fix WebView header APIs and behavior - Change WebView to return dictionary of headers instead of strings (this is needed for Android) - Change StaticContentProvider to use filename (always exists) instead of physical file path (not always available) to determine MIME type - Fix WPF sample bug * Update dependencies from https://github.com/dotnet/efcore build 20210329.2 (dotnet#31352) [main] Update dependencies from dotnet/efcore * Update dependencies from https://github.com/dotnet/efcore build 20210327.1 (dotnet#31309) [release/6.0-preview3] Update dependencies from dotnet/efcore * Update dependencies from https://github.com/dotnet/runtime build 20210329.3 (dotnet#31363) [release/6.0-preview3] Update dependencies from dotnet/runtime * Refactor logging in generic classes (dotnet#31364) * Update dependencies from https://github.com/dotnet/efcore build 20210329.4 (dotnet#31366) [release/6.0-preview3] Update dependencies from dotnet/efcore * Update dependencies from https://github.com/dotnet/efcore build 20210329.3 (dotnet#31353) [main] Update dependencies from dotnet/efcore * Make RequestDelegateFactory public (was MapActionExpressionTreeBuilder) (dotnet#31171) * Make RequestDelegateBuilder public - Formerly known as MapActionExpressionTreeBuilder * Add new BuildRequestDelegate overloads * Address PR feedback * RequestDelegateBuilder -> RequestDelegateFactory * Build -> Create * Address final review feedback. * [Http] Remove some unsafe code and save a string allocation (dotnet#31267) * Use one shot pbkdf2 (dotnet#31200) * Use one shot pbkdf2 * Update NetCorePbkdf2Provider.cs * CR feedback * CR feedback * Fix * Just use GetBytes for now * Update NetCorePbkdf2Provider.cs * Use interned Header Names for known headers not in the pre-allocated block (dotnet#31311) * Use interned headernames for known headers not in the preallocated block * Switch Connection header values for interned values * Use interned strings for websockets * Keep baggage, tracestate, and traceparent with previous casing * Update src/Servers/Kestrel/shared/KnownHeaders.cs Co-authored-by: Chris Ross <Tratcher@Outlook.com> * Feedback Co-authored-by: Chris Ross <Tratcher@Outlook.com> * Revert global.json changes * Modify constructor * Remove IReceiveHotReloadContext and HotReloadContext (dotnet#31281) * Remove IReceiveHotReloadContext and HotReloadContext React to API review feedback. Substitute IReceiveHotReloadContext and HotReloadContext with RenderHandle.IsHotReloading * Fixup * Update src/Components/Components/src/RenderHandle.cs * Update src/Components/Components/src/Properties/ILLink.Substitutions.xml * Update src/Components/Components/src/Properties/ILLink.Substitutions.xml * Flow Kestrel CancellationTokens to BindAsync (dotnet#31377) * Update dependencies from https://github.com/dotnet/runtime build 20210329.5 (dotnet#31384) [main] Update dependencies from dotnet/runtime * [main] Update dependencies from dotnet/arcade (dotnet#31349) [main] Update dependencies from dotnet/arcade * Quarantine flaky test (dotnet#31389) * Clean up NetCore PBKDF2 provider. (dotnet#31391) * Update dependencies from https://github.com/dotnet/runtime build 20210330.7 (dotnet#31394) [release/6.0-preview3] Update dependencies from dotnet/runtime * Add a FeaturesCollection constructor that supports initial capacity (dotnet#31381) * Add a FeaturesCollection constructor that supports initial capacity * Raise authenticationFailed event when cert validation fails (dotnet#31370) * Unquarantine UseStartupFactoryWorks (dotnet#31297) * Update dependencies from https://github.com/dotnet/efcore build 20210330.1 (dotnet#31400) [release/6.0-preview3] Update dependencies from dotnet/efcore * Update dependencies from https://github.com/dotnet/efcore build 20210330.2 (dotnet#31401) [main] Update dependencies from dotnet/efcore * Fix generated CSS scopes in layout views and update templates (dotnet#31257) * Fix generated CSS scopes in layout views and update templates * Update template baselines * Enabled scoped CSS for MVC template tests * Bring back static CSS file * Quarantine ClosesAfterDataSent (dotnet#31405) * Update CONTRIBUTING.md (dotnet#31371) Removed tab that seemed to cause a paragraph about the new help wanted label to be in a code fence. * Support round trip serialization of AuthenticationProperties with System.Text.Json (dotnet#31330) dotnet#20722 * Update Microsoft.Net.Compilers.Toolset (dotnet#31403) * Improve test failures for unexpected logs (dotnet#31406) * Add ToString() to Testing's log WriteContext * Update StrictTestServerTests to only show unexpected log * Undo template change that induced flakiness (dotnet#31417) * Add helpful exception message when exception handler returns 404 (dotnet#31142) * Update dependencies from https://github.com/dotnet/runtime build 20210331.6 (dotnet#31421) [release/6.0-preview3] Update dependencies from dotnet/runtime * Do not serialize Parameters property on AuthenticationProperties (dotnet#31414) * Do not serialize Parameters Explicitly prevent the Parameters dictionary from being included in the deserialized payload. See dotnet#31330 (comment). * Ignore props backed by Items Also ignore the properties backed by the Items dictionary to minimise the size of the serialized JSON payload. * Add ignoreLineEndingDifferences Stop tests from failing on non-Windows OSs due to different line endings. * ArPow stage 1: local source-build infrastructure (dotnet#31235) Conflicts: eng/Version.Details.xml Co-authored-by: John Luo <johluo@microsoft.com> * [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#31411) [main] Update dependencies from dotnet/runtime dotnet/efcore * Update dependencies from https://github.com/dotnet/efcore build 20210331.4 (dotnet#31424) [release/6.0-preview3] Update dependencies from dotnet/efcore * Fix project path in slnf (dotnet#31431) * Fix trailing comma in Caching.slnf (dotnet#31438) * Fix file headers in src/Caching (dotnet#31439) * [SignalR Java] Update to RxJava3 (dotnet#31426) * Fixed de-duping hosting startup assemblies (dotnet#31440) - De-dupe hosting startup assemblies based on assembly instance not the name of the assembly. Names can be short or long and we don't know if they resolve to the same assembly. Instead of trying to mess with names, we just check to make sure that the instance isn't the same. * Trim down framework references for Blazor dev server (dotnet#31420) * Only include Microsoft.AspNetCore.App framework reference for Blazor dev server * Address feedback from peer review * Use SharedFxVersion property * Cross-target last few projects to DefaultNetCoreTargetFramework (dotnet#31239) * Cross-target last 2 projects to DefaultNetCoreTargetFramework * More projects * Fixup * Fixup again * Fixup * Undo SiteExtension change * Update src/SiteExtensions/LoggingBranch/LB.csproj Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> * [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#31425) [main] Update dependencies from dotnet/runtime dotnet/efcore * Use integer division trick to get exact base64 length (dotnet#31442) * Add nullability to more MVC assemblies (dotnet#31338) * Add nullability to more MVC assemblies * [x] MVC.Cors * [x] Mvc.DataAnnotations * [x] Mvc.Localization * [x] Mvc.Newtonsoft.Json * [ ] Mvc.ViewFeatures (partial) * Fixup * Update src/Mvc/Mvc.ViewFeatures/src/Rendering/ViewContext.cs * Apply suggestions from code review * Update RazorPagePropertyActivator.cs * Update assembly check on EventHandlerTagHelperDescriptorProvider (dotnet#31458) * Remove legacy routing (dotnet#31295) * [release/6.0-preview3] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#31451) [release/6.0-preview3] Update dependencies from dotnet/runtime dotnet/efcore * Update dependencies from https://github.com/dotnet/arcade build 20210331.6 (dotnet#31427) [main] Update dependencies from dotnet/arcade - Merge branch 'main' into darc-main-2c400715-e553-48d8-8d43-983dc7aa4b7d * Update dependencies from https://github.com/dotnet/efcore build 20210401.3 (dotnet#31468) [main] Update dependencies from dotnet/efcore * Fix project paths in Azure.slnf (dotnet#31435) * Fix project paths in Azure.slnf * Update Azure.slnf * Update IdentityModel versions to 6.10.0 dotnet#31454 (dotnet#31482) * Removed static activity source from hosting (dotnet#31483) * Removed static activity source from hosting - Get it from DI instead * Fixed test * Use Random.Shared property (dotnet#31453) * Use Random.Shared Use the new .NET 6 Random.Shared static property where possible. See dotnet/runtime#50297. * Revert WebApi-CSharp changes For some reason I don't understand, this template doesn't see Random.Shared when compiled so this reverts the previous change for this template. * Remove baseline suppressions from 5.0 (dotnet#29934) * Remove baseline suppressions from 5.0 * Use newer NuGet.Protocol version - v4.8.2 ➡️ v5.8.1 * Fix condition * Back to 5.8.1 * Undo components changes * Whoops * Whoops Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> * Remove DNT from pre-reserved headers (dotnet#31493) No modern browser uses it anymore * Reuse HttpProtocol CTS (dotnet#31466) * Change Router _emptyParametersDictionary to a regular Dictionary (dotnet#31460) * Change Router _emptyParametersDictionary to a regular Dictionary This allows for ReadOnlyDictionary to be trimmed in a default Blazor WASM app. Saving roughly 3 KB .br compressed. Contributes to dotnet#30098 * Update src/Components/Components/src/Routing/Router.cs Co-authored-by: James Newton-King <james@newtonking.com> * Clean up some MVC code (dotnet#31511) * Clean up some MVC code * PR feedback * Do not throwing on InputBase.Dispose() if not in EditContext. (dotnet#31510) * Do not throwing on InputBase.Dispose() if not in EditContext. Fixes dotnet#30990 * Cache filters between requests in the ordinary case (dotnet#31513) In the normal case, * only the DefaultFilterFactoryProvider is registered * all filters registered by the framework are reusable We could so something targeted and cache filter instances between requests. * Update dependencies from https://github.com/dotnet/arcade build 20210403.1 (dotnet#31526) [main] Update dependencies from dotnet/arcade * Flaky tests (dotnet#31502) * Revert "Update assembly check on EventHandlerTagHelperDescriptorProvider (dotnet#31458)" (dotnet#31530) This reverts commit 7bc87ba. * Ability to deactivate DataAnnotationsValidation dynamically. Fixes dotnet#31027 (dotnet#31413) * Use UriHelper.BuildAbsolute for RedirectToHttpsRule (dotnet#28899) * Use UriHelper.BuildAbsolute and UriHelper.BuildRelative for RedirectRule (dotnet#28903) * Still send 100 Continue with null MinRequestBodyDataRate (dotnet#31543) * Update Selenium/Playwright (dotnet#31497) * Update Selenium/Playwright * Update selenium-config.json * Update Versions.props * Added VSCode debugging (for MvcSandbox) & code analysis support (dotnet#29486) * Added VSCode debugging support for MvcSandbox * Added ignored vscode folders * 1. Convered some more projects. 2. Added env variable for TargetFramework and used it in launch.json file rather than hardcoding TFW. * Addressed PR feedback. 1. Removed extensions.json 2. Updated BuildFromSource.md for Vscode instructions. 3. Added launch settings for BasicTestApp. * Addressed PR feedback! * Implement new SmallCapacityDictionary for dictionaries with a small amount of values. (dotnet#31360) * Fix duplicated event names in KestrelTrace logger. (dotnet#31523) (dotnet#31554) * Update area-owners.md (dotnet#31552) * Data Protection minor tidying (dotnet#31512) * Remove unused code Remove unused constant, method and variable. * Remove array allocations Use Array.Empty() instead of allocating an empty array. Use a static array for activation type instead of creating a new one per invocation. * Rename field Address PR feedback. * [SignalR TS] Improve connection error messages (dotnet#31402) * [MVC] Fix MSB4186 error (dotnet#31066) Fix MSB4186 error if a project references Microsoft.AspNetCore.Mvc.Testing that is not itself an ASP.NET project, such as a helper library in a test suite. * Re-use cancellation tokens in the https middleware (dotnet#31528) * Re-use cancellation tokens in the https middleware - These tokens are usually short lived and exist for the purposes of cancelling the handshake. * Fix IPNetwork.Contains behavior for prefixes which are not at start of subnet range (dotnet#31573) * Update branding to 5.0.6 (dotnet#31563) * Use skipEnabledCheck for LoggerMessage.Define (dotnet#31562) * Use skipEnabledCheck in MVC * Use skipEnabledCheck in Http/Routing DefaultLinkGenerator, DefaultLinkParser, and DfaMatcher * Use skipEnabledCheck in SignalR * Use skipEnabledCheck in Components * Use skipEnabledCheck in Hosting * Use skipEnabledCheck in Servers/HttpSys * Use skipEnabledCheck in Servers/Kestrel * Use skipEnabledCheck in Middleware * Avoid some allocations by checked IsEnabled first in MVC * Avoid some allocations by checked IsEnabled first in Servers/Kestrel * Simplify usage of logging in transports * Fix up typo in Blazor Server launchSettings.json (dotnet#31580) * Rename 'Blazor component' to 'component' to be more generic (dotnet#31590) Co-authored-by: Adrian Wright <adrian@compiledcoding.co.uk> * Update branding to 3.1.15 (dotnet#31577) * Update branding to 3.1.15 Update Ubuntu 16.04 to 18.04 * Remove obsolete groovy code * [release/5.0] Update nuget versions (dotnet#31490) * Update nuget/msbuild versions * Update nuget * Nuget only * Fix baseline, update to 5.8.1 * Undo test change * Update MetadataSerializerTest.cs * Set cab name for TargetingPack.wixproj (dotnet#30975) * Added IConnectionSocketFeature (dotnet#31588) - Removed the nullable from the Socket property as approved in API review - Make the IConnectionSocketFeature an additional feature instead of one implemented on the TransportConnection. - Added a test to verify it works * Fix null ref in SyntaxTokenCache (dotnet#30978) (dotnet#30988) Fixes dotnet#27154 * Still send 100 Continue with null MinRequestBodyDataRate (dotnet#31568) * [SignalR TS] Fix permanent Disconnecting state (dotnet#30948) (dotnet#31253) * Fix arguments order for call of HeartbeatSlow (dotnet#28698) (dotnet#31080) Co-authored-by: Roman Marusyk <Marusyk@users.noreply.github.com> * Quarantine one failing test (dotnet#31045) (dotnet#31296) - dotnet#31044 - `RazorPagesTemplate_RazorRuntimeCompilation_BuildsAndPublishes()` Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> * Fix merge * Fix merge * Update HubConnection.Reconnect.test.ts * Update default-build.yml * Error boundaries (dotnet#30874) * Remove unused ADAL dependency (dotnet#31484) * Remove unused dependency * Remove outdated AAD sample * Custom event args: support receiving IJSObjectReference (dotnet#31591) * Add failing E2E case * Implement fix * Add E2E test * Update src/Components/test/testassets/BasicTestApp/EventCustomArgsComponent.razor * Update suppressions * [SignalR TS] Set keep alive timer in receive loop (dotnet#31300) * Unskip some fixed E2E tests (dotnet#31614) * Fix "no event handler" in simultaneous blur+removal case (dotnet#31612) * [SPA] Introduces new approach for proxying the SPA templates (dotnet#31564) * A new package Microsoft.AspNetCore.SpaProxy has been added that is used by the templates to launch their development proxy via npm/yarn. * The SPA development proxy for each CLI now is the frontend for the application and proxies the requests to the backend which is the ASP.NET Core application. * At publish time the application assets are copied to the wwwroot. * SpaServices.Extensions has been removed from the templates since it is no longer needed. MapFallbackToFile("index.html") handles unknown requests and serves the SPA entry point. * The templates have been updated to keep using HTTPS with the SPA proxy configured to use the ASP.NET Core HTTPS development certificate via a new aspnetcore-https.js file that ships within the template. * The configuration for angular has been updated with a proxy.conf.js file to proxy requests to the backend. * The entry point for the application in development is now https://localhost:5002 when using https and http://localhost:5002 otherwise. * Infer default sources for parameters of minimal actions (dotnet#31603) This does a big chunk of dotnet#30248 while heavily refactoring the RequestDelegateFactory by splitting it out into a bunch of smaller methods. For part 2 of dotnet#30248, a "scalar value type that lives in the System namespace", I went with the alternative of "Something convention-based like the presence of a bool TryParse(string, out T) method" instead. This conventions work for types in any namespace including user-defined types. * Avoid closure caused by local function (dotnet#31641) * Avoid closure caused by local function - Made the local function static and passed state via parameters. * Remove form support from minimal APIs (dotnet#31646) * Remove form support from minimal APIs * Add * MapActionSample -> MinimalSample * Remove MapActionSample.csproj from Mvc.slnf * [Templates] Update the react template to use the CLI proxy (dotnet#31652) Updates the react template to use the http-proxy-middleware for handling the requests instead of the asp.net core proxy in the same way it's done for the Angular template. * [SignalR] Allocate HubCallerClients once per connection (dotnet#31661) * [main] Update dependencies from dotnet/emsdk dotnet/efcore dotnet/runtime (dotnet#31576) [main] Update dependencies from dotnet/emsdk dotnet/efcore dotnet/runtime - Add `RemoveDevicePlatformSupport` To `Microsoft.AspNetCore.Authentication.Negotiate.csproj` Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Andre Milbradt <andremi@microsoft.com> Co-authored-by: Andre Milbradt <onegoodsausage@users.noreply.github.com> Co-authored-by: Pranav K <prkrishn@hotmail.com> Co-authored-by: Hao Kung <HaoK@users.noreply.github.com> Co-authored-by: David Fowler <davidfowl@gmail.com> Co-authored-by: Safia Abdalla <safia@microsoft.com> Co-authored-by: Kristian Hellang <kristian@hellang.com> Co-authored-by: msftbot[bot] <48340428+msftbot[bot]@users.noreply.github.com> Co-authored-by: James Newton-King <james@newtonking.com> Co-authored-by: Chris Ross <Tratcher@Outlook.com> Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com> Co-authored-by: Kevin Pilch <kevinpi@microsoft.com> Co-authored-by: Javier Calvarro Nelson <jacalvar@microsoft.com> Co-authored-by: Doug Bunting <6431421+dougbu@users.noreply.github.com> Co-authored-by: N. Taylor Mullen <nimullen@microsoft.com> Co-authored-by: Eilon Lipton <Eilon@users.noreply.github.com> Co-authored-by: Brennan <brecon@microsoft.com> Co-authored-by: Shreyas Jejurkar <shreyasjejurkar123@live.com> Co-authored-by: Justin Kotalik <jukotali@microsoft.com> Co-authored-by: Gabriel Lucaci <gabriel.lucaci.dev@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Tratcher <Tratcher@users.noreply.github.com> Co-authored-by: John Luo <johluo@microsoft.com> Co-authored-by: Martin Costello <martin@martincostello.com> Co-authored-by: William Godbe <wigodbe@microsoft.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Allison Chou <allichou@microsoft.com> Co-authored-by: Anthony J <reapsprgm@gmail.com> Co-authored-by: Jonathan Berube <jdberube@gmail.com> Co-authored-by: dotnet <dotnet@users.noreply.github.com> Co-authored-by: Günther Foidl <gue@korporal.at> Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Ben Adams <thundercat@illyriad.co.uk> Co-authored-by: Andrzej <andrzej.pindor@gmail.com> Co-authored-by: Stephen Halter <halter73@gmail.com> Co-authored-by: Kevin Jones <vcsjones@github.com> Co-authored-by: Marek Linka <mareklinka@users.noreply.github.com> Co-authored-by: Kevin Miller <scoundrel@gmail.com> Co-authored-by: Michael Simons <msimons@microsoft.com> Co-authored-by: Youssef Victor <youssefvictor00@gmail.com> Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com> Co-authored-by: fvoronin <fvoronin@gmail.com> Co-authored-by: Paulo Morgado <470455+paulomorgado@users.noreply.github.com> Co-authored-by: Tanay Parikh <TanayParikh@users.noreply.github.com> Co-authored-by: Adrian Wright <47532258+adrianwright109@users.noreply.github.com> Co-authored-by: Adrian Wright <adrian@compiledcoding.co.uk> Co-authored-by: Sébastien Ros <sebastienros@gmail.com> Co-authored-by: Roman Marusyk <Marusyk@users.noreply.github.com>
Am I using this incorrectly? I implemented as per Documentation in My test involved throwing a generic exception with a message from a child component in I also tried creating a custom class that implemented ErrorBoundary, but this did not help either. |
Hi @thirstyape. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
Implements #26953 as per the design at #30940.
This is a nontrivial feature but hopefully you'll find the implementation size isn't unreasonable. The differences since the previous design review are:
AutoRecover
, replaced with newRecover
method, and added an overridableOnErrorAsync
for subclasses to do whatever they want with)ErrorContent
fragment to your error boundaryblazor-error-boundary
CSS rule. This is enough to provide static content like an icon, some fixed text, and your chosen colors.ErrorBoundary
and render whatever you want.Rather than writing up a lot more details here, I've updated the design proposal. So if you want context on all the behaviors covered here, please read through that again, especially the new parts like "Errors after disposal".
Let's watch out for perf
I am concerned that adding extra
try
/catch
blocks within the perf-critical rendering internals might have a meaningful impact on rendering performance on WebAssembly. If I recall correctly, the WebAssembly runtime still goes through a JavaScript trampoline for each try/catch. @pranavkm If you know the latest details on how the per-PR-benchmarking works, it would be great to know how to check the impact this PR is having.