robincornelius / libedssharp

A CanOpen EDS editor and library in C# with CanOpenNode export for Object Dictionary
GNU General Public License v3.0
231 stars 135 forks source link

Crash with custom "Memory type" #184

Open aquaid3 opened 4 years ago

aquaid3 commented 4 years ago

Hey there,

This is probably a low-priority edge case, but wanted to report it in case anyone else runs into it.

Bug:

How to reproduce:

  1. In EDSEditor, load an .xdd file with custom memory type entries, for example memory_type_bug.xdd.txt (.txt extension added for github upload to work).
  2. Click on Object Dictionary tab
  3. Under Manufacturer specific objects, click on 0x2000 Special memory entry.
    3a. The Memory type field is blank instead of showing the custom type. Hmmm...
  4. Under Manufacturer specific objects, click on 0x2001 Normal memory entry.
    4a. Seems ok.
  5. Under Manufacturer specific objects, click on 0x2000 Special memory entry.
    5a. Get a crash (see log below).

Note: tested on git hash 2e53bbc running on linux (lubuntu 18.04).

Related:

Workaround 1:

  1. In EDSEditor, load an .xdd file with custom memory type entries.
  2. "Export Device File" to .xml type
  3. Click on Object Dictionary tab
  4. Under Manufacturer specific objects, click on 0x2000 Special memory entry.
    4a. Note that the Memory type field is now correct.

Note: Repeat step 2 every time you load a file with custom memory type entries.

Workaround 2:

Crash log:

System.NullReferenceException: Object reference not set to an instance of an object at ODEditor.DeviceODView.comboBox_memory_SelectedIndexChanged (System.Object sender, System.EventArgs e) [0x0000c] in :0 at System.Windows.Forms.ComboBox.OnSelectedIndexChanged (System.EventArgs e) [0x00023] in :0 at System.Windows.Forms.ComboBox.SetSelectedIndex (System.Int32 value, System.Boolean supressAutoScroll) [0x000ab] in :0 at System.Windows.Forms.ComboBox.set_SelectedIndex (System.Int32 value) [0x00000] in :0 at System.Windows.Forms.ComboBox.set_SelectedItem (System.Object value) [0x0004b] in :0 at (wrapper remoting-invoke-with-check) System.Windows.Forms.ComboBox:set_SelectedItem (object) at ODEditor.DeviceODView.validateanddisplaydata () [0x0025e] in :0 at ODEditor.DeviceODView.list_mouseclick (System.Windows.Forms.ListView listview, System.Windows.Forms.MouseEventArgs e) [0x001cb] in :0 at ODEditor.DeviceODView.listView_manufacture_objects_SelectedIndexChanged (System.Object sender, System.EventArgs e) [0x00012] in :0 at System.Windows.Forms.ListView.OnSelectedIndexChanged (System.EventArgs e) [0x0001c] in :0 at System.Windows.Forms.ListView.OnSelectedIndexChanged () [0x0000b] in :0 at (wrapper remoting-invoke-with-check) System.Windows.Forms.ListView:OnSelectedIndexChanged () at System.Windows.Forms.ListViewItem.SetSelectedCore (System.Boolean value) [0x000ac] in :0 at System.Windows.Forms.ListViewItem.set_Selected (System.Boolean value) [0x00028] in :0 at System.Windows.Forms.ListView.UpdateMultiSelection (System.Int32 index, System.Boolean reselect) [0x0023f] in :0 at (wrapper remoting-invoke-with-check) System.Windows.Forms.ListView:UpdateMultiSelection (int,bool) at System.Windows.Forms.ListView+ItemControl.ItemsMouseDown (System.Object sender, System.Windows.Forms.MouseEventArgs me) [0x002b4] in :0 at System.Windows.Forms.Control.OnMouseDown (System.Windows.Forms.MouseEventArgs e) [0x0001c] in :0 at System.Windows.Forms.Control.WmLButtonDown (System.Windows.Forms.Message& m) [0x00097] in :0 at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00177] in :0 at System.Windows.Forms.ListView+ItemControl.WndProc (System.Windows.Forms.Message& m) [0x00099] in :0 at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in :0 at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in :0 at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x0008e] in :0