You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Data writer reports serialization errors while writing data with inheritance.
Expected Behavior
DataWriter (and reader as well) should be able to work with DynamicData types defined in the XML with inheritance.
Current Behavior
Data writers cannot write data type payload (e.g. struct) with inheritance.
Steps to Reproduce
Define DynamicData struct with inheritance in the XML.
Create a topic for appropriate type, register type for participant, create readers and writers etc.
Try to write data using DataWriter.
System information
Fast-RTPS version: 2.4.0
OS: Ubuntu 20.04
Additional context
Seems that the size of parent dynamic data type is ignored while serialized size calculation. The following hotfix, seems, works for me, but unfortunately I'm not sure if it is enough or how it can affect other functionality.
diff --git a/src/cpp/dynamic-types/DynamicData.cpp b/src/cpp/dynamic-types/DynamicData.cpp
index 4536ccbbe..cfa8de39b 100644
--- a/src/cpp/dynamic-types/DynamicData.cpp
+++ b/src/cpp/dynamic-types/DynamicData.cpp
@@ -6181,6 +6181,10 @@ size_t DynamicData::getMaxCdrSerializedSize(
case TK_STRUCTURE:
case TK_BITSET:
{
+ if(auto base_type{type->get_base_type()}){
+ current_alignment += getMaxCdrSerializedSize(base_type);
+ }
+
for (auto it = type->member_by_id_.begin(); it != type->member_by_id_.end(); ++it)
{
if (!it->second->descriptor_.annotation_is_non_serialized())
The text was updated successfully, but these errors were encountered:
MiguelCompany
changed the title
DataWriter cannot serialize (write) DynamicData struct with inheritance
DataWriter cannot serialize (write) DynamicData struct with inheritance [13363]
Jan 3, 2022
Hi @lexamor, Fast DDS v3.0.0 has been released, including a Dynamic Types refactor that may have fixed your issue. Could you check if the problem persists?
As the Dynamic Types refactor has been already introduced in the latest Fast DDS v3.0.0, we internally agreed to close all Dynamic-Types related issues.
We elaborated a Migration guide to help with the upgrade process to this new major release.
Please, feel free to reopen it if the issue persists.
Data writer reports serialization errors while writing data with inheritance.
Expected Behavior
DataWriter (and reader as well) should be able to work with DynamicData types defined in the XML with inheritance.
Current Behavior
Data writers cannot write data type payload (e.g. struct) with inheritance.
Steps to Reproduce
System information
Additional context
Seems that the size of parent dynamic data type is ignored while serialized size calculation. The following hotfix, seems, works for me, but unfortunately I'm not sure if it is enough or how it can affect other functionality.
Additional resources
The text was updated successfully, but these errors were encountered: