Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-26-2005
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Dummy c# mapping question

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:
Code:
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):

Code:
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:

Code:
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!
Attached Files
File Type: zip collectiontest.zip (38.6 KB, 27 views)
Reply With Quote
  #2 (permalink)  
Old 02-26-2005
DeepDiver's Avatar
DeepDiver DeepDiver is offline
Registered User
 
Name: Thomas Müller
Organization: Freelance Software Developer
Project: Project depend on Customers
 
Join Date: Nov 2004
Location: Munich, Bavaria, Germany
Posts: 100
Lightbulb

hi,

i just debugged through the code. it seems to be a bug in the generated server code:
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
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; }
Reply With Quote
  #3 (permalink)  
Old 02-27-2005
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Quote:
Originally Posted by DeepDiver
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
Reply With Quote
  #4 (permalink)  
Old 02-27-2005
DeepDiver's Avatar
DeepDiver DeepDiver is offline
Registered User
 
Name: Thomas Müller
Organization: Freelance Software Developer
Project: Project depend on Customers
 
Join Date: Nov 2004
Location: Munich, Bavaria, Germany
Posts: 100
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
Reply With Quote
  #5 (permalink)  
Old 02-27-2005
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 907
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.
Reply With Quote
  #6 (permalink)  
Old 02-27-2005
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 907
I've posted a patch at http://www.zeroc.com/vbulletin/showt...=5194#post5194. Thanks for the bug report!

Cheers,

Michi.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mapping Exception ganzuoni Comments 2 02-14-2008 07:39 AM
Which language mapping(s) do you use? marc Comments 12 05-31-2006 07:19 AM
Dictionary mapping in cpp DeepDiver Comments 1 04-07-2005 09:06 AM
C mapping colding Comments 4 03-31-2005 05:48 AM
OR mapping questions stephan Help Center 2 02-04-2005 04:42 PM


All times are GMT -4. The time now is 07:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.