We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
After the PR #975, ActivityProcessor will implement IDisposable. With netstandard2.1, we can also implement IAsyncDisposable.
IDisposable
IAsyncDisposable
Below one example that @pcwiese sent me:
public class TestClass : IDisposable #if NETSTANDARD2_1 , IAsyncDisposable #endif { /// <inheritdoc/> public void Dispose() { if (Interlocked.CompareExchange(ref this.disposed, 1, 0) == 1) { return; } this.Dispose(true); GC.SuppressFinalize(this); } #if NETSTANDARD2_1 /// <inheritdoc/> public async ValueTask DisposeAsync() { if (Interlocked.CompareExchange(ref this.disposed, 1, 0) == 1) { return; } // see https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-disposeasync#the-disposeasync-method // Perform async cleanup. await this.DisposeAsyncCore().ConfigureAwait(false); // Dispose of managed resources. this.Dispose(false); // Suppress finalization. GC.SuppressFinalize(this); } #endif /// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { } #if NETSTANDARD2_1 /// <summary> /// Releases unmanaged and - optionally - managed resources asynchronously. /// </summary> /// <returns>a ValueTask</returns> protected virtual ValueTask DisposeAsyncCore() { return default; } #endif }
cc: @reyang
The text was updated successfully, but these errors were encountered:
Doesn't seem like there is demand for this, so I'm going to close, feel free to reopen if you think this is still required.
Sorry, something went wrong.
No branches or pull requests
After the PR #975, ActivityProcessor will implement
IDisposable
. With netstandard2.1, we can also implementIAsyncDisposable
.Below one example that @pcwiese sent me:
cc: @reyang
The text was updated successfully, but these errors were encountered: