Class DisposeAtProcessTermination
- Namespace
- BenchmarkDotNet.Helpers
- Assembly
- BenchmarkDotNet.dll
Ensures that explicit Dispose is called at termination of the Process.
public abstract class DisposeAtProcessTermination : IDisposable
- Inheritance
-
DisposeAtProcessTermination
- Implements
Remarks
This class exists to help in reverting system state where C#'s using statement does not suffice. I.e. when Benchmark's process is aborted via Ctrl-C, Ctrl-Break or via click on the X in the upper right of Window.
Usage: Derive your clas that changes system state of this class. Revert system state in override of Dispose() implementation. Use your class in C#'s using statement, to ensure system state is reverted in normal situations. This class ensures your override is also called at process 'abort'.
Note: This class is explicitly not responsible for cleanup of Native resources. Of course, derived classes can cleanup their Native resources (usually managed via SafeHandle derived classes), by delegating explicit Disposal to their IDisposable fields.
Constructors
DisposeAtProcessTermination()
protected DisposeAtProcessTermination()
Methods
Dispose()
public virtual void Dispose()