Repository navigation
Crash when trying to map a custom SDO into a TPDO. #211
Description
Describe the bug
I created a custom SDO (type OCTET_STRING of 8 bytes) at index 0x2000, when I try to map that into a PDO the application crashes.
To Reproduce
Add a new SDO with 0x2000, is a bit cumbersome to get it in, you first have to insert some predefined profiles.
The SDO is an OCTET_STRING of 8 bytes.
Access SDO : rw
Access PDO : no => This was not specified in my original bug report and is WRONG.
Access SRDO: no
String len Min: 0
Try to add it into a TPDO mapping parameter with the value 0x20000140.
Unfortunately I cannot simply reproduce it with a new "empty" project. Then the programs says "Not mappable OD entry 0x2000.0x01. Why?
Probably I have to upload my xdd file so you can reproduce it
It is part of an attempt to map CleanOpen fixed TPDO's (For a GeesinkNorba) into some usable EDS file, they do some weird thing but it could be done to my opinion, so I can make a test project.
Version used
v4.2.3-0-gc1071ab
Expected behavior
It shall not crash, buit give a message what is eventually wrong.
Screenshots
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: ColumnSpan
at SourceGrid.Cells.Cell.set_ColumnSpan(Int32 value)
at ODEditor.DevicePDOView2.UpdatePDOinfo(Boolean updatechoices) in D:\a\CANopenEditor\CANopenEditor\EDSEditorGUI\DevicePDOView2.cs:line 472
at ODEditor.DeviceView.dispatch_updatePDOinfo() in D:\a\CANopenEditor\CANopenEditor\EDSEditorGUI\DeviceView.cs:line 99
at ODEditor.MyTabUserControl.doUpdatePDOs() in D:\a\CANopenEditor\CANopenEditor\EDSEditorGUI\MyTabUserControl.cs:line 45
at ODEditor.DeviceODView.PopulateObjectLists(EDSsharp eds_target) in D:\a\CANopenEditor\CANopenEditor\EDSEditorGUI\DeviceODView.cs:line 194
at ODEditor.DeviceODView.ObjectSave() in D:\a\CANopenEditor\CANopenEditor\EDSEditorGUI\DeviceODView.cs:line 629
at System.Windows.Forms.Control.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.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9310.0 built by: NET481REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
EDSEditor
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file://windc/usershares/Henri%20de%20Veer/Documents/CANOpen/net481/EDSEditor.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9256.0 built by: NET481REL1LAST_B
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9320.0 built by: NET481REL1LAST_B
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9032.0 built by: NET481REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
libEDSsharp
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file://windc/usershares/Henri%20de%20Veer/Documents/CANOpen/net481/libEDSsharp.DLL
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9032.0 built by: NET481REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9316.0 built by: NET481REL1LAST_C
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9032.0 built by: NET481REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9032.0 built by: NET481REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
Microsoft.GeneratedCode
Assembly Version: 1.0.0.0
Win32 Version: 4.8.9032.0 built by: NET481REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
SourceGrid
Assembly Version: 4.40.4580.29115
Win32 Version: 4.40.4580.29115
CodeBase: file://windc/usershares/Henri%20de%20Veer/Documents/CANOpen/net481/SourceGrid.DLL
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Additional context
Add any other context about the problem here.
files upload
Activity
henri62 commentedon Dec 18, 2025
In the attached file, try to adjust SDO 0x1A62, Sub 0x01 (TPDO 99 mapping parameter) to 0x20000140.
It crashes or it first says "Not mappable OD entry en0x2000.0x01" before it crashes.
It will save something, but when I open the file I get this:
And the editor is empty.
cleanopen-geesinknorba.zip
If I edit line 2276 and remove the 0x20000140 from <q1:defaultValue value="0x20000140" /> into <q1:defaultValue value="0x0" /> the file can be opened again.
Note that SDO 0x2000 type suddenly changes from OCTET_STRING to DOMAIN?
I tried to use a standard object ID of 0x9FFF too, does not matter, still crashes. It looks that a TPDO mapping to an OCTET_STRING is causing the problem.
Workaround:
I worked around this problem now by making an manufacturer specific object 0x2000 with 8 sub entries of 8 bytes. The map all the bytes individually into the TPDO mapping parameters.
nimrof commentedon Dec 21, 2025
Thanks for the good bug report @henri62
A different workaround is to set the default value for OCTET_STRING entry so the length is 8.
That works for me.
Need a little help here for permanent fix @trojanobelix @CANopenNode
This happens because Sizeofdatatype for OCTET_STRING returns 0 if default values is not filled with something, that crashes the gui because the pdo mapping does not support odEntry of size 0
fix suggestion:
https://github.com/CANopenNode/CANopenEditor/blob/main/libEDSsharp/eds.cs#L1481
That makes it easier to set the size instead of using default value
Alternatively we could not list odEntry with size 0, but that does not indicate to the use whats wrong to the user.
A different alternative is to set min bit size to 1, but also show a pop-up box explaining why it is size 1
Also: should domain be mappable to pdo?
trojanobelix commentedon Dec 26, 2025
Maybe it is enought to display a Message?
if (mappingentry.width == 0){ MessageBox.Show(string.Format("Nothing to map in 0x{0:X}!\r\nThe Object to map has a width of 0.\r\n", slot.ConfigurationIndex)); break; }DS301 allows length of the object in bit from 1..40h => 8bytes = 64 bit. It does not really make sense to map a domain, as it is normally used for lage data (IMHO). But can not find that it is forbidden (if sizeof is 8 bytes or less)
trojanobelix commentedon Dec 28, 2025
@CANopenNode Janez, do you know whether DS301 allows mapping? AI tells me that all strings and domains must not be mapped, but when you look at the sources, there isn't much information. According to AI, only variables with a fixed length may be mapped. Which makes sense, in my opinion. On the other hand, canEDS doesn't complain during testing if you map STRINGS or DOMAIN.
henri62 commentedon Dec 28, 2025
I could not find a reference too. Mapping DOMAINS looks silly/useless too. All other types should be mappable, if they fit, to my opinion.
Only dummy/void entries look restricted in CiA301. It says in paragraph 7.4.7.1
I quote: "The static data types are placed in the object dictionary for definition purposes only. Indices in the
range from 0001h to 0007h, 0010h, from 0012h to 0016h, and from 0018h to 001Bh may be mapped in
order to define the appropriate space in the RPDO as not being used by this CANopen device (do not
care). Other objects of the object code DEFTYPE and DEFSTRUCT shall not be mapped into
RPDOs."
This means that object types 0x9 VISIBLE_STRING and 0x0A OCTET_STRING cannot be mapped as void /dummy filler which is reasonable of coarse. For example: time of day uses a VOID4 dummy to align the bits to 16.
But the mapping is not the real issue I started with, its the application crash when you try to map anything (wrong or not) that should not occur. The program should at least give an error. And the issue that the xdd file is not usable any more afterwards without editing.
trojanobelix commentedon May 31, 2026
Please try PR #220
trojanobelix commentedon Jun 12, 2026
Using the version provided at PR #220, I was able to open the xdd file available at #211 (comment).
If the problem persists, please let me know how I can reproduce it.
henri62 commentedon Jun 12, 2026
I found the issue what was the original problem here:
Access PDO : tr => This was not specified in my original bug report (I added this later, see start topic).
The setting was the default "no" So the message "not mappable" is actually correct.
What I also saw in that case that the application crashed on that, which actually ofcourse should not, but I'm not able to reproduce that problem (with the same version) any more.
So to my opinion you may close this issue "Not a bug".
trojanobelix commentedon Jun 12, 2026
According to the OP, it's not a bug, so I'm closing this issue.