2012-05-17

I can't figure out why I'm unable to catch an exception thrown by MS Chart control. I'm using Visual Studio 2010, with latest updates. Appreciating your help.

Here's how to re-produce the issue:

Create a new WinForms application

Add a reference to System.Windows.Forms.DataVisualization

On the main form drop a button and a chart control

Add the following code the form's constructor

Add the following code to the button's click method

Run the application

Click the button on the form

The catch block above is never executed. Instead the "InvalidOperationException" thrown by the invalid keyword use in the label string bubbles up to the application's Main method.

Show more