The answer is yes, it does work. You can read about it in the documentation (and get sample code too).
If you need to know why in your specific scenario it doesn't you'll have to update your question with sample code that fails and most importantly details about the thrown exception, if any.