Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash if trying to change (increase) object data type that is mapped #129

Closed
trojanobelix opened this issue Aug 6, 2024 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@trojanobelix
Copy link
Collaborator

Crash if trying to change SDO Data Type to DOMAIN in object directory
Crash when saving the changes!

Reason:
The object is RX mapped!
Change type to DOMAIN will not fit in PDO 8 + 32 bit.
Shoud happen with all changes were the mapping does not fit.

Possible reaction:
Catch exception and abort saving

image

image

************** Ausnahmetext **************
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'ColumnSpan')
at SourceGrid.Cells.Cell.set_ColumnSpan(Int32 value)
at ODEditor.DevicePDOView2.UpdatePDOinfo(Boolean updatechoices) in C:\Git_lokal\CANopenEditor\EDSEditorGUI\DevicePDOView2.cs:line 466
at ODEditor.DeviceView.dispatch_updatePDOinfo() in C:\Git_lokal\CANopenEditor\EDSEditorGUI\DeviceView.cs:line 100
at ODEditor.MyTabUserControl.doUpdatePDOs() in C:\Git_lokal\CANopenEditor\EDSEditorGUI\MyTabUserControl.cs:line 44
at ODEditor.DeviceODView.PopulateObjectLists(EDSsharp eds_target) in C:\Git_lokal\CANopenEditor\EDSEditorGUI\DeviceODView.cs:line 191
at ODEditor.DeviceODView.ObjectSave() in C:\Git_lokal\CANopenEditor\EDSEditorGUI\DeviceODView.cs:line 585
at ODEditor.DeviceODView.Button_saveChanges_Click(Object sender, EventArgs e) in C:\Git_lokal\CANopenEditor\EDSEditorGUI\DeviceODView.cs:line 443
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

@trojanobelix trojanobelix changed the title Crash if trying to change Data Type to DOMAIN Crash if trying to change (increase) object data type that is mapped Aug 6, 2024
@CANopenNode
Copy link
Owner

Problem is here:

grid1[row + 2, bitoff + 3].ColumnSpan = entry.Sizeofdatatype();

ColumnSpan gets value 0 and it crashes. We should prevent crash with if or try statement or something.

The question is, how to handle this and similar situations:

First solution

Catch exception and abort saving

Second solution

UpdatePDOinfo() should verify the configuration and show warnings, similar as with some exporters. I prefer this approach because: it is simpler, more clear, more flexible for usage and it is user responsibility to fix the warnings.

We could use second solution (display warning) and also abort saving, but I think, that could be annoying for the user. Warning will remind him to fix PDO mapping and I think, this is enough.

@nimrof nimrof added the bug Something isn't working label Aug 13, 2024
trojanobelix added a commit to trojanobelix/CANopenEditor that referenced this issue Nov 7, 2024
@trojanobelix
Copy link
Collaborator Author

Should be fixed with #144 2711f0c. Closed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants