Home Help Center

Dummy c# mapping question

stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
Hello!

I'm using the c# mapping for the first time and ran into the problem where the manual didn't help me.

I have this slice definition:
module Example01
{
	struct Item
	{
		string key;
		string value;
	};
	
	["cs:collection"] sequence<Item> DummyList;
	
	class MyObject
	{
		bool setOptions(DummyList list);
	};
};

and implemented the client like this with (m_object being the proxy handle):
if (m_object != null)
{
	DummyList list = new DummyList();
	Item item      = new Item();
	item.key       = "key01";
	item.value     = "value01";
	
	System.Console.WriteLine("Items in list:");
	list.Add(item);
	
	foreach(Item l in list)
	{
		System.Console.WriteLine(l.key);
	}
	m_object.setOptions(list);
}

For some reason, the item doesn't reach it's destination, thus the server side:
public override bool setOptions(DummyList list, Ice.Current current)
{
	System.Console.WriteLine("Items in list:");
	foreach (Item l in list)
	{
		System.Console.WriteLine(l.key);
	}
	
	return true;
}

show an empty list.

What am I doing wrong here? Things work with the standard array (Item[]) but the array functionality is not sufficient thus collection is required...

I have attached the cited example to this posting. Hope it helps...

Thanks in advance!

Comments

  • DeepDiverDeepDiver Member Thomas MuellerOrganization: Freelance Software DeveloperProject: Project depend on Customers ✭✭✭
    hi,

    i just debugged through the code. it seems to be a bug in the generated server code:
    	public static IceInternal.DispatchStatus ___setOptions(MyObject __obj, IceInternal.Incoming __in, Ice.Current __current)
    	{
    	    IceInternal.BasicStream __is = __in.istr();
    	    IceInternal.BasicStream __os = __in.ostr();
    	    Example01.DummyList list;
    	    {
    		int szx = __is.readSize();
    		__is.startSeq(szx, 2);
    		list = new Example01.DummyList(szx);
    [QUOTE]at this point the list has a capacity of szx, but the count is 0[/QUOTE] 
    		for(int __ix = 0; __ix < list.Count; ++__ix)
    		{
    		    list[__ix].__read(__is);
    		    __is.checkSeq();
    		    __is.endElement();
    		}
    		__is.endSeq(szx);
    	    }
    	    bool __ret = __obj.setOptions(list, __current);
    	    __os.writeBool(__ret);
    	    return IceInternal.DispatchStatus.DispatchOK;
    	}
    
  • stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
    DeepDiver wrote:
    i just debugged through the code. it seems to be a bug in the generated server code.

    Thanks for the feedback. SharpDevelop unfortunately doesn't have no debugger yet, so debugging wasn't possible for me.

    But apparently the error wasn't caused by me :) Might there be an error in the slice2cs compiler?!

    Stephan
  • DeepDiverDeepDiver Member Thomas MuellerOrganization: Freelance Software DeveloperProject: Project depend on Customers ✭✭✭
    stephan,

    dotnet sdk has a GUI debugger in folder GuiDebug.

    the error is in the ice generated code.
    zeroc guys should have a look at this.
    probably we need to post this in the forum 'bug reports'

    cu tom
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    Sorry for the slow reply, I only just now saw this thread. I'll have a look at this today. Clearly, the generated code isn't right. I'll post a patch as soon as I've fixed it.

    Cheers,

    Michi.
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    I've posted a patch at http://www.zeroc.com/vbulletin/showthread.php?p=5194#post5194. Thanks for the bug report!

    Cheers,

    Michi.
Sign In or Register to comment.