OverflowException from autogenerated C# idl

8 posts / 0 new
Last post
Offline
Last seen: 3 years 6 months ago
Joined: 03/12/2016
Posts: 4
OverflowException from autogenerated C# idl

When I use the GUI RTI DDS Code Generator on the attached idl file with the settings shown in the attached jpg file I get an overlfowexception in the

get_serialized_sample_max_size method. I also attached the auto generated qos profile since when i searched the forums there was some indication it might be there.

 

Did I do something wrong or is this a bug in the auto generated code?

AttachmentSize
Binary Data payloadtype.idl736 bytes
Image icon rtigent.jpg137.01 KB
File user_qos_profiles.xml5.5 KB
Organization:
Offline
Last seen: 1 year 3 months ago
Joined: 01/17/2013
Posts: 23

Hi nanney,

Your idl file has a sequence that is unbounded (binaryPayload) and you are generating code with the -unboundedSupport option (you can see the tick in your jpg image). As a consequence, the get_serialized_sample_max_size of your type can be really big (depending on the numer of elements your sequence contains), that is why the code is throwing an exception.

If you want to know the actual size of one of your samples you can use the get_serialized_sample_size API.

If you don't use the -unboundedSupport flag, the default maxSize of your sequence will be 100, and then the get_serialized_sample_max_size  will return you the actual value of the biggest size your sample can have. You can change that default vaule for all your sequences using the -sequenceSize <size>  option or specify a maximum size for your sequence in the idl : sequence <octect, maxSize> binaryPayload with your maxSize desired size.

Let me know if that answer your question.

Regards,

Aida

 

Offline
Last seen: 3 years 6 months ago
Joined: 03/12/2016
Posts: 4

Aida,

Unfortunately this does not answer my question I created the example code according to the inputs I gave above and it would not run and I did not modify the code at all during the create of the datawriter for PayloadType it calls the above method so I do not have control over this as it enters RTI code. I assumed that this example would work out of the box without modification. Although I agree with your assesment that is should not being calling this method it does not make sense in this case. Did you get a chance to run this example? I'm running version 5.2.0 of the RTI libraries.

Offline
Last seen: 1 year 3 months ago
Joined: 01/17/2013
Posts: 23

Hi nanney,

A generated hello_world with your idl is working fine for me. Are you calling explicitely to the get_serialized_sample_max_size method or do you get it just running the generated publisher and subscriber? Have you change the publisher to add some data?

The hello_world example should work fine out of the box (as we are capturing that exception when we internally call to the method). 

Aída

Offline
Last seen: 3 years 6 months ago
Joined: 03/12/2016
Posts: 4

The exception is caught but the DataWriter returned from publisher.create_datawriter(...) is null. I did not change any code I just ran the code generator and built it and ran it. I did have to copy the rti_license file into the output directory to get it past creating the domain participant. That was the only variant from building the auto generated code and running it.

Offline
Last seen: 1 week 21 hours ago
Joined: 11/19/2015
Posts: 11

Hello Nanney,

I have tried to reproduce the issue using Visual Studio 2010 Professional but I do not find any runtime error. (I have tried also with VS2013 and VS2012, same result, no error).

I have attached file vs2010.zip with the project I have generated with the same options you use in rtigent.jpg. I am also adding environment variables

set NDDSHOME=C:\Program Files\rti_connext_dds-5.2.0
set PATH=%NDDSHOME%\lib\x64Win64VS2010;%PATH%
set PATH=%NDDSHOME%\bin;%PATH%

Could you check what are the differences with your generated project and your environment variables?

Could you attach the source code of the project that you generate so I can try to reproduce the error you have?

Regards,

Francis.

File Attachments: 
Offline
Last seen: 3 years 6 months ago
Joined: 03/12/2016
Posts: 4

I figured it out. The projects are exactly the same except casing but and I did not have any of the env vars setup which fixed my need to copy the license file into the directory. The real issue is that the USER_QOS_PROFILES.xml was not being copied into the output directory so I was trully loading the default QOS. My guess is you have one of the paths setup on your box to load a profile that does support unbounded. All I had to do to fix the example project is select one of the copies of USER_QOS_PROFILES.xml and tell it to copy to the output directory. Thanks to both of you for helping me out and being so responsive.

Offline
Last seen: 1 week 21 hours ago
Joined: 11/19/2015
Posts: 11

Hello Nanney,

rtiddsgen will add some QoS into USER_QOS_PROFILES.xml which are needed when using option "unbounded support". Your application was failing because those QoS were not loaded.

Note that usually we run the application just from the project folder, e..g, in case your solution is on folder c:\solution and QoS is on c:\solution\USER_QOS_PROFILES.xml, the generated .exe would maybe be on .\solution\bin\x64\Debug-VS2013\HelloWorld_publisher.exe, you could run your aapplication as

c:\solution> .\bin\x64\Debug-VS2013\HelloWorld_publisher.exe <domain_id>

the application will search for file USER_QOS_PROFILES.xml in the current working directory and NOT in the directory where the .exe is located.

Regards,

Francis.