Bug #51602 Unexcepted exception
Submitted: 1 Mar 2010 10:58 Modified: 19 Apr 2010 10:34
Reporter: David Hirst Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.2.16 Beta OS:Microsoft Windows (XP SP3)
Assigned to: Alfredo Kojima CPU Architecture:Any
Triage: Needs Triage: D2 (Serious)

[1 Mar 2010 10:58] David Hirst
Description:
Exception = System.Runtime.InteropServices.SEHException
Message = External component has thrown an exception.
FullText = System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at bec.FKConstraintColumnsListBE.get_column_is_fk(FKConstraintColumnsListBE* , NodeId* )
   at MySQL.Grt.Db.FKConstraintColumnsListBE.get_column_is_fk(NodeId node)
   at MySQL.GUI.Workbench.Plugins.DbMysqlTableFkColumnListModel.columnEnabledFkNodeControl_CheckStateChanged(Object sender, TreePathEventArgs e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Aga.Controls.Tree.NodeControls.NodeCheckBox.OnCheckStateChanged(TreePathEventArgs args)
   at Aga.Controls.Tree.NodeControls.NodeCheckBox.OnCheckStateChanged(TreeNodeAdv node)
   at Aga.Controls.Tree.NodeControls.NodeCheckBox.SetCheckState(TreeNodeAdv node, CheckState value)
   at Aga.Controls.Tree.NodeControls.NodeCheckBox.MouseDown(TreeNodeAdvMouseEventArgs args)
   at Aga.Controls.Tree.TreeViewAdv.OnMouseDown(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

How to repeat:
I was creating a foreign key relationship in the ERR Diagram editor when the bug window opened and reported an exception.
[1 Mar 2010 11:30] David Hirst
It appears to be thrown when you are matching a relationship between two fields of a different type or even size for example INT(10) to INT(11) OR TINYINT(3) to INT(10)
[1 Mar 2010 13:32] Johannes Taxacher
Hi David,

how did you connect the fields involved in the FK? Di you use the tool (shortcut 6) or the editor to create the key connection. while the first method lets me create keys connecting columns with different definitions (which is bad, but another topic), using the editor to hook columns together which are not identically typed should not be possible (and isnt for me).
Can you reproduce the problem? (if yes, please give us some detailed instructions how to do so)
thanks in advance
[2 Mar 2010 10:05] David Hirst
Hi Johannes,

OK, this problem seems to occur at random and now I am not so sure it is to do with mismatches in the data types but it is definitely something to do with matching foreign keys. The problem occurs when I edit the table like so,

1. Select a table
2. Edit the table using the context menu -> edit table
3. Select foreign keys tab
4. Create a FK mapping between two tables

This is when the error usually gets thrown up but it doesn't happen all the time. I am going to record my desktop whilst using the program to see exactly what I am doing when the error occurs.
[10 Mar 2010 11:20] Susanne Ebrecht
Please provide the backtrace.

More information about backtracing you will find here:

http://bugs.mysql.com/how-to-report.php
[11 Mar 2010 14:24] David Hirst
Ok I beleive I can replicate the problem,

1. Create at least two tables like so,
tblOne -> Id (Int(10))
       -> FK (Int(10))
tblTwo -> Id (Smallint(5))

2. Edit tblTwo by right clicking the table in the EER diagram
3. Click foreign Keys tab
4. Type a foreign key name "tblTwo_to_tblOne"
5. Select tblOne as the reference table
6. At this point you cannot select any fields to match (though if you click the reference column once and then once again an empty combo box appears.
7. Your diagram should now show a relationship from tblTwo to tblOne even though there is no relation fields checked in either table
8. Now edit tblOne
9. Go to foreign keys tab
10. Create a foreign key name "tblOne_to_tblTwo"
11. Select tblTwo as the reference table
12. Now click one of the ID fields and you should get the following exception error,

Exception = System.Runtime.InteropServices.SEHException
Message = External component has thrown an exception.
FullText = System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at bec.FKConstraintColumnsListBE.get_column_is_fk(FKConstraintColumnsListBE* , NodeId* )
   at MySQL.Grt.Db.FKConstraintColumnsListBE.get_column_is_fk(NodeId node)
   at MySQL.GUI.Workbench.Plugins.DbMysqlTableFkColumnListModel.columnEnabledFkNodeControl_CheckStateChanged(Object sender, TreePathEventArgs e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Aga.Controls.Tree.NodeControls.NodeCheckBox.OnCheckStateChanged(TreePathEventArgs args)
   at Aga.Controls.Tree.NodeControls.NodeCheckBox.OnCheckStateChanged(TreeNodeAdv node)
   at Aga.Controls.Tree.NodeControls.NodeCheckBox.SetCheckState(TreeNodeAdv node, CheckState value)
   at Aga.Controls.Tree.NodeControls.NodeCheckBox.MouseDown(TreeNodeAdvMouseEventArgs args)
   at Aga.Controls.Tree.TreeViewAdv.OnMouseDown(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
[11 Mar 2010 14:54] David Hirst
I have a video example but for some reason the FTP on MySql's site keeps timing me out so I have uploaded the video here temporarily.

http://www.cepsworld.com/bug-data-51602.zip

I apologise for the quality of the video but I do not have a decent converter for AVI files (the original video is 500Mb!)
[16 Mar 2010 12:11] Valeriy Kravchuk
Verified just as described in your comment dated 11 Mar 15:24. Thank you very much for your continuous efforts.
[15 Apr 2010 0:22] Alfredo Kojima
Crash has been fixed. Thank you very much for the detailed instructions for repeating
[16 Apr 2010 9:38] Johannes Taxacher
fix confirmed in repository
[19 Apr 2010 10:34] Tony Bedford
An entry has been added to the 5.2.19 changelog:

MySQL Workbench crashed when creating a foreign key relationship in the EER Diagram view.