the BarManager component eats my exceptions

Bars for Windows Forms Forum

Posted 15 years ago by BLANC Stéphane - Staubli Robotics Suite Product Manager, STAUBLI
Version: 2.0.0107
Platform: .NET 3.5
Environment: Windows XP (32-bit)

This bug is easy to reproduce:
I customized a command by derivating a class from the BarButtonCommand class, in the OnClick overriden method, I throw an exception.

When the command is executed from a toolbar or a menu, the exception is caught in my Application.ThreadException handler, but when the same command is executed from the keyboard shortcut, no exception is caught !!!

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA

I'm not sure we have any code to catch exceptions from command handlers however it is a good idea to catch exceptions that occur during keyboard shortcuts because the keyboard shortcut hook comes from Windows API, and if an exception bubbled up in one of those handlers then the app is never notified of the exception (through Application.ThreadException) and the app crashes without a way to prevent it. It's probably because we handle keys from a Windows message hook instead of via a Form, etc. I'm not sure there is anything we can do here. You would be better off handling your exception from within the command handler.

Actipro Software Support

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.