Usually not calling Dispose indicates a possible error or sloppy code and may lead to some hard to find bugs. Ideally I would like to spot if Disposed was not called during unit tests.
One of the methods we used was to put Debug.Assert in the Finalizer
#if DEBUG ~MyClass() { Debug.Assert(false, “MyClass.Dispose() was not called”); } #endif
And we found ourselves clicking through assert message boxes but it didn’t work well with continuous integration builds that would ignore the popups.
If you log this somehow instead of using a Debug.Assert, and used dependency injection to specify your logger implementation, then you could use mock testing to catch this. So, your class may take a logger instance in its constructor, or provide a default one, and then behave like this: