Placing something inside a try
/catch
block does not make it "properly handled" - in fact, in the vast majority of cases, the correct way of handling an exception is to let it bubble up to the next level. Caveat: try
/finally
is much more common, to allow for resource clean-up, but even more common than that is using
.
You cannot enforce "and you must use it correctly" on code; that is implicit in any API, and you will just be causing irritation and annoyance, and forcing people into inappropriate and unhelpful coding styles, while giving you a completely artificial and incorrect sense of the code being correct.
If you want to be sure that the code functions correctly: test it.
There are no attributes that you can use for this scenario. You can probably create an FxCop rule or similar, but for the reasons above: I do not recommend it.