EDDiscovery / EDDiscovery

Captains log and 3d star map for Elite Dangerous
Apache License 2.0
769 stars 171 forks source link

Attempting to open journal history window threw error #1284

Closed tivec closed 7 years ago

tivec commented 7 years ago

On version 8.2.7.0, trying to open the journal history window threw an error. Restarting EDDiscovery has worked out fine. Log attached.

Trace_20170923181433.0.log

klightspeed commented 7 years ago

Suggests that a row somehow didn't have a history entry attached to it.

It looks like there may be the potential for a race to occur between the row being added and the tag being set where the row is painted asynchronously.

phroggster commented 7 years ago
[2017-09-23 18:15:02Z]
==== UNHANDLED UI EXCEPTION ====
System.NullReferenceException: Object reference not set to an instance of an object.
   at EDDiscovery.UserControls.UserControlTravelGrid.PaintEventColumn(DataGridView grid, DataGridViewRowPostPaintEventArgs e, Int32 totalentries, HistoryEntry he, Int32 hpos, Int32 colwidth, Boolean showfsdmapcolour)
   at EDDiscovery.UserControls.UserControlJournalGrid.dataGridViewJournal_RowPostPaint(Object sender, DataGridViewRowPostPaintEventArgs e)
   at System.Windows.Forms.DataGridView.OnRowPostPaint(DataGridViewRowPostPaintEventArgs 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)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
==== cut ====
klightspeed commented 7 years ago

Perhaps UserControlTravelGrid.PaintEventColumn should return without doing anything it he is null?

It looks like Debug.Assert doesn't actually do anything on a non-debug build.

phroggster commented 7 years ago

That's the correct answer, but it does bring up another problem: Debug.Assert is contained within our code 143 times (including some commented lines). How many of these also need to should be updated? Well, I'm going to nominate the 58 instances of System.Diagnostics.Debug.Assert(true); for starters.

robbyxp1 commented 7 years ago

Debug.Assert is supposed to be out in release code.. ;-)