DbcParser icon indicating copy to clipboard operation
DbcParser copied to clipboard

The GenMsgCycleTime field of the message is parsed as 0.

Open huohuaing opened this issue 6 months ago • 2 comments

I have a DBC file where the characteristics such as GenMsgCycleTime and GenMsgStartDelayTime are of floating-point type. This file can be opened normally by Vector CANdb++.

Image Image

I found that floating-point numbers cannot be parsed by int.TryParse, resulting in a value of 0 being returned.

Image

I have changed the code to use all the parsing operations with double.TryParse.

Image

huohuaing avatar Jul 05 '25 15:07 huohuaing

@huohuaing we had problems with similar issues before Like: BA_DEF_ SG_ "GenSigMissingSourceValue" INT 0 1e+09; which wouldnt get parsed aswell but is valid in can db++

you might wanna create a pull request for this. One thing for your code tough: All int32 values fit into double so no Problem there. But you can create a silent overflow in casting to int. We allready have a similar discussion in #91 which isnt fully resolved yet.

Uight avatar Jul 06 '25 19:07 Uight

Thank you for your reply. Before converting to an integer, I added a check. If overflow occurs, the program will throw an exception. But there is another way to limit the post-conversion to the int range. I am not sure which method is better.

huohuaing avatar Aug 21 '25 09:08 huohuaing