Is it possible to determine if code is currently executing in the context of a finally handler as a result of an exception being thrown? I\'m rather fond of usi
finally
The best I can come up with would be:
using (var scope = MyScopedBehavior.Begin()) { try { //Do stuff with scope here } catch(Exception) { scope.Cancel(); throw; } }
Of course, scope.Cancel() would make sure nothing happens in Dispose()
scope.Cancel()