Not sure if it will fly, but couldn't we utilize the same tech as project lombok [1] uses to automatically generate detach code for IDetachables?
Note that I have no idea if it will work, but considering they are able to generate try/finally blocks, we might be able to do something similar. Martijn [1] http://projectlombok.org
