, , , , , , IIS7.5 Debug.Fail , . :
I only do this in the debug build , as it will not have any benefit for the release build. In addition, it removes the slow finalizer from classes that do not contain unmanaged resources directly.
public void Dispose()
{
#if DEBUG
GC.SuppressFinalize(this);
}
~MyClass()
{ throw new ObjectNotDisposedException();
#endif
}
There are times when a missing order can really intimidate an application, for example. remote transaction context. Termination in this case is no worse and will be on the lazy nerves of the developers. I always prefer to return problems to their source.
source
share