Jump to content
OpenSplice DDS Forum
mdbk

C# sequence of enum values doesn't compile - error in ReadInt32

Recommended Posts

mdbk   

Using: VortexOpenSplice-6.7.170912OSS-HDE-x86_64.win-vs2015  

I've run across an error where it looks like idlpp is generating some non-compiling C# code if the IDL has a sequence of enum values in it.  E.g if you tweak the HelloWorld.idl as seen below the generated C# source will no longer compile:

module HelloWorldData
{
   enum T_WorldType
   {
      L_WorldType_Flat,
      L_WorldType_Round,
      L_WorldType_Unknown
   };
   
   typedef sequence <T_WorldType> T_ListOfWorldTypes;

   struct Msg
   {
      long userID;
      string message;
      T_ListOfWorldTypes A_supportedWorldTypes;
   };
   #pragma keylist Msg userID
};

To reproduce do the following:

  1. Swap out the IDL in the HelloWorld with the attached IDL
  2. Compile it using: idlpp -l cs -S HelloWorldData.idl
  3. Replace the generated .cs files in examples\dcps\HelloWorld\cs\standalone with the newly generated files
  4. Compile the the sacs_helloworld_pub project and you'll see the following error:
    1. CS7036  There is no argument given that corresponds to the required formal parameter 'offset' of 'BaseMarshaler.ReadInt32(IntPtr, int)'
    2. The generated code is missing the first argument to the ReadInt32 call:
      1. to.A_supportedWorldTypes[i0] = (HelloWorldData.T_WorldType) ReadInt32(attr2Seq0Buf);

Note that the generated .cpp code compiles fine, it's just the C# that doesn't seem to be working correctly.

Any ideas?

Thank you very much.

HelloWorldData.idl

Share this post


Link to post
Share on other sites

Hi,

Thanks for raising this.  I've reproduced it  and am talking to the PrismTech engineering team about it.

For now, I got it to compile by changing the command to "Marshal.ReadInt32(attr2Seq0Buf);"

Are you able to use that as as workaround for now?  Obviously it's a bit awkward cos it's generated code.   I'll check whether that's actually a valid workaround, and of course make sure the generated code is fixed in a future release.

Thanks

James

Share this post


Link to post
Share on other sites
mdbk   

Hi James,

Thanks for the response, yes I'm able to make the change in the generated code that you mentioned.  Please let me know if that's a legitimate workaround and I'll apply it to some other IDLs we've got that exhibit the same problem.

Thanks much.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×