In the IDisposable.Dispose
method is there a way to figure out if an exception is being thrown?
using (MyWrapper wrapper = new MyWrapper())
{
No, there is no way to do this in the .Net framework, you cannot figure out the current-exception-which-is-being-thrown in a finally clause.
See this post on my blog, for a comparison with a similar pattern in Ruby, it highlights the gaps I think exist with the IDisposable pattern.
Ayende has a trick that will allow you to detect an exception happened, however, it will not tell you which exception it was.