Skip to content

Commit 580d2e1

Browse files
authored
Adds reference to IAsyncDisposable interface (#7282)
* Adds reference to IDisposableAsync interface As seen in issue #25968 * References actual IAsyncDisposable link * Add IAsyncDisposable remarks * Add remark about CloseAsync
1 parent 4b24c92 commit 580d2e1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

xml/System/ObjectDisposedException.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@
5555
<format type="text/markdown"><![CDATA[
5656
5757
## Remarks
58-
An <xref:System.ObjectDisposedException> is thrown when you try to access a member of an object that implements the <xref:System.IDisposable> interface, and that object has been disposed. Typically, this exception is caused by one of the following conditions:
58+
An <xref:System.ObjectDisposedException> is thrown when you try to access a member of an object that implements the <xref:System.IDisposable> interface or <xref:System.IAsyncDisposable> interface, and that object has been disposed. Typically, this exception is caused by one of the following conditions:
5959
60-
- You've called an object's `Dispose` method, and you're trying to access an instance member that gets or sets the object's state. The following example illustrates the <xref:System.ObjectDisposedException> that is thrown when you try to reset the frequency of timer notifications after you call the <xref:System.Threading.Timer.Dispose%2A?displayProperty=nameWithType> method.
60+
- You've called an `IDisposable` object's `Dispose` method (or an `IDisposableAsync` object's `DisposeAsync` method), and you're trying to access an instance member that gets or sets the object's state. The following example illustrates the <xref:System.ObjectDisposedException> that is thrown when you try to reset the frequency of timer notifications after you call the <xref:System.Threading.Timer.Dispose%2A?displayProperty=nameWithType> method.
6161
6262
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.objectdisposedexception/cs/dispose1.cs" id="Snippet1":::
6363
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.objectdisposedexception/vb/dispose1.vb" id="Snippet1":::
6464
65-
- You've called an object's `Close` method, and you're trying to access an instance member that gets or sets the object's state. Often, the `Close` method provides a type's public implementation of the <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType> method.
66-
67-
- You've called an object's `Dispose` method multiple times. Typically, this doesn't throw an exception. However, depending on how a type implements <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType>, it may not allow multiple calls to `Dispose`.
65+
- You've called an object's `Close` method, and you're trying to access an instance member that gets or sets the object's state. Often, the `Close` method provides a type's public implementation of the <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType> method. The same is true for `CloseAsync` and `<xref:System.IAsyncDisposable.DisposeAsync%2A?displayProperty=nameWithType>`.
6866
67+
- You've called an object's `Dispose` or `DisposeAsync` methods multiple times. Typically, this doesn't throw an exception. However, depending on how a type implements <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType> or <xref:System.IAsyncDisposable.DisposeAsync%2A?displayProperty=nameWithType>, it may not allow multiple calls to that method.
68+
6969
In most cases, this exception results from developer error. Instead of handling the error in a `try`/`catch` block, you should correct the error, typically by reinstantiating the object.
7070
7171

0 commit comments

Comments
 (0)