Bug #50207 System.AccessViolationException: Attempted to read or write protected memory.
Submitted: 10 Jan 2010 2:29 Modified: 14 Jan 2010 6:06
Reporter: Halbert Stone Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.2.11 4842 OS:Windows
Assigned to: CPU Architecture:Any

[10 Jan 2010 2:29] Halbert Stone
MySQL Workbench aplication was left running after doing some work. About 24hrs later the SQL code that had been entered into the SQL Statements window was RUN by selecting the RUN 'lightening' icon. The output window displayed a red border with red lines forming a X, and the Exception, appended below, was displayed.
CODE run: 
      CREATE PROCEDURE sp_full()
      COMMENT  'Returns a random number'

************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at MySQL.Grt.ListModel.get_field(NodeId node, Int32 column, String& value)
   at MySQL.Utilities.GridView.OnCellValueNeeded(Object sender, DataGridViewCellValueEventArgs e)
   at System.Windows.Forms.DataGridView.OnCellValueNeeded(DataGridViewCellValueEventArgs e)
   at System.Windows.Forms.DataGridView.OnCellValueNeeded(Int32 columnIndex, Int32 rowIndex)
   at System.Windows.Forms.DataGridViewCell.GetValue(Int32 rowIndex)
   at System.Windows.Forms.DataGridViewCell.GetFormattedValue(Int32 rowIndex, DataGridViewCellStyle& cellStyle, DataGridViewDataErrorContexts context)
   at System.Windows.Forms.DataGridViewTextBoxCell.GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, Int32 rowIndex, Size constraintSize)
   at System.Windows.Forms.DataGridViewCell.GetPreferredHeight(Int32 rowIndex, Int32 width)
   at System.Windows.Forms.DataGridViewRow.GetPreferredHeight(Int32 rowIndex, DataGridViewAutoSizeRowMode autoSizeRowMode, Boolean fixedWidth)
   at System.Windows.Forms.DataGridView.AutoResizeRowInternal(Int32 rowIndex, DataGridViewAutoSizeRowMode autoSizeRowMode, Boolean fixedWidth, Boolean internalAutosizing)
   at System.Windows.Forms.DataGridView.AutoResizeRow(Int32 rowIndex, DataGridViewAutoSizeRowMode autoSizeRowMode, Boolean fixedWidth)
   at System.Windows.Forms.DataGridView.AutoResizeRow(Int32 rowIndex)
   at MySQL.Utilities.GridView.OnRowPrePaint(Object sender, DataGridViewRowPrePaintEventArgs e)
   at System.Windows.Forms.DataGridView.OnRowPrePaint(DataGridViewRowPrePaintEventArgs e)
   at System.Windows.Forms.DataGridViewRow.Paint(Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, Int32 rowIndex, DataGridViewElementStates rowState, Boolean isFirstDisplayedRow, Boolean isLastVisibleRow)
   at System.Windows.Forms.DataGridView.PaintRows(Graphics g, Rectangle boundingRect, Rectangle clipRect, Boolean singleHorizontalBorderAdded)
   at System.Windows.Forms.DataGridView.PaintGrid(Graphics g, Rectangle gridBounds, Rectangle clipRect, Boolean singleVerticalBorderAdded, Boolean singleHorizontalBorderAdded)
   at System.Windows.Forms.DataGridView.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DataGridView.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 have not repeated it, however the fact that the exception occurred maybe of interest to you.
[11 Jan 2010 14:13] Susanne Ebrecht
Did you reboot your computer?

Did you check your disc?

This really looks like a hardware problem on your side.
[13 Jan 2010 1:34] Halbert Stone
NOTES in response to 
"[11 Jan 15:13] Susanne Ebrecht
Did you reboot your computer?
Did you check your disc?
This really looks like a hardware problem on your side."
I did not reboot, nor did i check my disc. What I did was use MySQLWorkbench for several hours practicing SQL Code from examples found via GOOGLE.  I had entered some code into the SQL Edit panel, then left my computer. It is my habit to leave it running (I rarely log-out, restart, or reboot). I cam back to my computer the next day and began where I had left off. I clicked the "Lightening" Icon to run the code already entered.
After the problem all I did to correct it was to restart SqlWorkbench, and reconnect to my database. It has worked well since.
[14 Jan 2010 6:06] Susanne Ebrecht
Many thanks for writing a bug report.

This is not a MySQL bug. The problem is related to Microsoft Windows.