This is a migrated thread and some comments may be shown as answers.

RadGridView for Winforms DragDrop event swallows exception

1 Answer 97 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tamás
Top achievements
Rank 1
Tamás asked on 29 Jul 2008, 09:07 AM
Hi,

why does the DragDrop event of RadGridView for Winforms (2008 Q2) swallow exceptions?

There are two RadGridViews on my form (radGridView1 and radGridView2) and these are their event handlers:

private

void radGridView2_MouseDown(object sender, MouseEventArgs e)
{
    radGridView2.DoDragDrop(
"some data", DragDropEffects.Copy);
}

private
void radGridView1_DragOver(object sender, DragEventArgs e)
{
    e.Effect =
DragDropEffects.Copy;
}

private
void radGridView1_DragDrop(object sender, DragEventArgs e)
{
    throw new Exception();
}

Try doing a drag&drop from radGridView2 to radGridView1! The form should report an unhandled exception. (Nothing seems to be catching the explicitly thrown exception. I don't handle it anywhere.) Instead the form continues waiting for events.

It was very hard to detect which part of our code is responsible for catching and not letting exceptions to be handled in an upper level. (The code is a bit more complex than the one I wrote here.)

That also means that whenever something unexpected happens that I don't handle in my code, the form will continue executing because it won't be able to handle the exception at the form's topmost level.

I'm looking forward to receiving an explanation for this weird behaviour.

Regards,
Tamás

1 Answer, 1 is accepted

Sort by
0
Angel
Telerik team
answered on 31 Jul 2008, 01:28 PM
Hello Tamás,

Thank you for writing.

I could not find a code that catches the thrown exception.

After several tests of your scenario with MS DataGridView I found that the exception is caught somewhere in the MS code - see the attached demo project.

It seems that this is a behavior in the MS Drag&Drop realization.

Kind regards,
Angel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Tamás
Top achievements
Rank 1
Answers by
Angel
Telerik team
Share this question
or