2.3.2.2. RTI Code Generator

2.3.2.2.1. C# code generation for optional sequences not supported

Code Generator now fails for optional sequences in C#. Previously, the optional annotation was silently ignored for sequences in C#. Now, Code Generator will fail if the IDL/XML/XSD file contains an optional sequence.

For example, this IDL will now fail for C#:

struct MyStruct {
    @optional
    sequence<long, 5> mySquence;
};

This problem is a known issue that will be fixed in a future release.

For now, the workaround is to use an empty sequence to emulate an unset optional. For example, for the following IDL:

struct Foo {
    sequence<long, 5> mySquence;
};

Suppose Connext published the following:

var sample = new Foo();
sample.mySquence.Add(5);
writer.Write(sample);
sample.mySquence.Clear();
writer.Write(sample);

After clearing the sequence in the fourth line, the fifth line will publish an empty sequence, which will emulate an unset optional.