Clarify component disposal async+sync (#25223)

pull/25224/head
Luke Latham 2022-03-07 07:22:57 -06:00 committed by GitHub
parent 33e97da4e7
commit a2cc68cc31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -218,6 +218,10 @@ Although the content in this section focuses on Blazor Server and stateful Signa
If a component implements <xref:System.IDisposable>, <xref:System.IAsyncDisposable>, or both, the framework calls for unmanaged resource disposal when the component is removed from the UI. Disposal can occur at any time, including during [component initialization](#component-initialization-oninitializedasync).
Components shouldn't need to implement <xref:System.IDisposable> and <xref:System.IAsyncDisposable> simultaneously. If both are implemented, the framework only executes the asynchronous overload.
Developer code must ensure that <xref:System.IAsyncDisposable> implementations don't take a long time to complete.
### Synchronous `IDisposable`
For synchronous disposal tasks, use <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType>.
@ -662,6 +666,10 @@ Although the content in this section focuses on Blazor Server and stateful Signa
If a component implements <xref:System.IDisposable>, <xref:System.IAsyncDisposable>, or both, the framework calls for unmanaged resource disposal when the component is removed from the UI. Disposal can occur at any time, including during [component initialization](#component-initialization-oninitializedasync).
Components shouldn't need to implement <xref:System.IDisposable> and <xref:System.IAsyncDisposable> simultaneously. If both are implemented, the framework only executes the asynchronous overload.
Developer code must ensure that <xref:System.IAsyncDisposable> implementations don't take a long time to complete.
### Synchronous `IDisposable`
For synchronous disposal tasks, use <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType>.
@ -1102,6 +1110,10 @@ Although the content in this section focuses on Blazor Server and stateful Signa
If a component implements <xref:System.IDisposable>, <xref:System.IAsyncDisposable>, or both, the framework calls for unmanaged resource disposal when the component is removed from the UI. Disposal can occur at any time, including during [component initialization](#component-initialization-oninitializedasync).
Components shouldn't need to implement <xref:System.IDisposable> and <xref:System.IAsyncDisposable> simultaneously. If both are implemented, the framework only executes the asynchronous overload.
Developer code must ensure that <xref:System.IAsyncDisposable> implementations don't take a long time to complete.
### Synchronous `IDisposable`
For synchronous disposal tasks, use <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType>.