B
Bern McCarty
I am porting stuff from MEC++ syntax to the new C++/CLI syntax. Something
that we did in the old syntax that proved to be very valuable was to make
sure that the finalizer would purposefully generate an assertion failure
for unoptimized, debug builds. We did this to find and fix cases where we
were relying upon finalization rather than pro-active Dispose() calls.
For classes that introduced IDisposable() into the class hierarchy themselves
we would do this:
protected: ~ColorBookEnumerator()
{
#if !defined (NDEBUG)
System:iagnostics:ebug::Assert(false, S"Neglected to call Dispose()
on object.");
#endif
this->Dispose(false);
}
For classes where IDisposable was already introduced into the class heirarchy
we would do this:
#if !defined (NDEBUG)
protected: ~ColorBookEnumerator()
{
System:iagnostics:ebug::Assert(false, S"Neglected to call Dispose()
on object.");
this->Dispose(false);
}
#endif
This has been very useful in helping us to find places where we were relying
upon the finalizer thread only by accident. How do I accomplish this using
the new C++/CLI syntax?
-Bern McCart
that we did in the old syntax that proved to be very valuable was to make
sure that the finalizer would purposefully generate an assertion failure
for unoptimized, debug builds. We did this to find and fix cases where we
were relying upon finalization rather than pro-active Dispose() calls.
For classes that introduced IDisposable() into the class hierarchy themselves
we would do this:
protected: ~ColorBookEnumerator()
{
#if !defined (NDEBUG)
System:iagnostics:ebug::Assert(false, S"Neglected to call Dispose()
on object.");
#endif
this->Dispose(false);
}
For classes where IDisposable was already introduced into the class heirarchy
we would do this:
#if !defined (NDEBUG)
protected: ~ColorBookEnumerator()
{
System:iagnostics:ebug::Assert(false, S"Neglected to call Dispose()
on object.");
this->Dispose(false);
}
#endif
This has been very useful in helping us to find places where we were relying
upon the finalizer thread only by accident. How do I accomplish this using
the new C++/CLI syntax?
-Bern McCart