C#: callback (ice_response) problem

kwaclawkwaclaw Oshawa, CanadaMember Karl WaclawekOrganization: Personal
I am getting a null pointer exception in the C# generated code when ice_response is called in an async dispatch situation.

The relevant Slice is:
struct Prop {
    int Index;
    Ice::ByteSeq Value;
  };
  
  sequence<Prop> PropSeq;

  interface Store {
     . . .
    ["ami", "amd"] idempotent
    PropSeq Get(Ice::ByteSeq key, Ice::IntSeq propIndexes) throws ServiceError;
     . . .
  };

The generated code for the call-back is as follows:
(I have marked the problem spot with a comment)
class _AMD_Store_Get : IceInternal.IncomingAsync, AMD_Store_Get
{
    public _AMD_Store_Get(IceInternal.Incoming inc) : base(inc)
    {
    }

    public void ice_response(Services.StorageServices.Prop[] ret__)
    {
        try
        {
            IceInternal.BasicStream os__ = this.os__();
            if(ret__ == null)
            {
                os__.writeSize(0);
            }
            else
            {
                os__.writeSize(ret__.Length);
                for(int ix__ = 0; ix__ < ret__.Length; ++ix__)
                {
                    ret__[ix__].write__(os__);  // issue here
                }
            }
        }
        catch(Ice.LocalException ex__)
        {
            ice_exception(ex__);
        }
        response__(true);
    }

    public void ice_exception(_System.Exception ex)
    {
        try
        {
            throw ex;
        }
        catch(Services.ServiceError ex__)
        {
            os__().writeUserException(ex__);
            response__(false);
        }
        catch(_System.Exception ex__)
        {
            exception__(ex__);
        }
    }
}

The problem occurs when the returned array contains nulls.

Karl

Comments

  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    Thanks for the bug report. I'll post a patch ASAP.

    Cheers,

    Michi.
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    Hi Karl,

    I've posted a patch for the problem. Thanks for reporting this! You need to apply the patch to cpp/src/Slice/CsUtil.cpp, rebuild slice2cs, and recompile your Slice definitions.

    Cheers,

    Michi.
  • kwaclawkwaclaw Oshawa, CanadaMember Karl WaclawekOrganization: Personal
    michi wrote: »
    Hi Karl,

    I've posted a patch for the problem. Thanks for reporting this! You need to apply the patch to cpp/src/Slice/CsUtil.cpp, rebuild slice2cs, and recompile your Slice definitions.

    Cheers,

    Michi.

    Thanks, the fix seems to work.
Sign In or Register to comment.