Archived
This forum has been archived. Please start a new discussion on GitHub.
problem with cs:class attribute
I have problems in C# if I had this slice file like this:
there is exception, that something in generated code on client side is null. It is when called getSocketInfo in time of reading response on client side. If I debug on server side it looks that server is sending data correctly. When I removed cs:class it it was OK, the program worked. (with other complicated structures the same)
sorry I dont have now more information, because I did it before week and I have data on other computer not there... ...and also I will not be there for some time
I tried it both on Mono 1.1.8.2 on linux and .NET Framework 2.0 beta 2 on Windows - both have the same error
... struct NeededSocket { string socketName; string functionIceId; }; sequence<NeededSocket> NeededSocketSeq; struct BoxType { string functionIceId; NeededSocketSeq neededSockets; }; sequence<BoxType> BoxTypeSeq; [cs:class] struct SocketInfo { string name; string label; string hint; string design; BoxTypeSeq socketType; StringSeq settingProperties; bool moreThanOne; }; sequence<SocketInfo> SocketInfoSeq; interface test { nonmutating SocketInfoSeq getSocketInfo(); }
there is exception, that something in generated code on client side is null. It is when called getSocketInfo in time of reading response on client side. If I debug on server side it looks that server is sending data correctly. When I removed cs:class it it was OK, the program worked. (with other complicated structures the same)
sorry I dont have now more information, because I did it before week and I have data on other computer not there... ...and also I will not be there for some time
I tried it both on Mono 1.1.8.2 on linux and .NET Framework 2.0 beta 2 on Windows - both have the same error
0
Comments
-
I just tried a simple client and server with your Slice definition, and things appear to work OK. Can you please send small, self-contained source code for client and server, so I can try and reproduce the problem?
Thanks,
Michi.0 -
a little bit bigger example
this is a little bit bigger example...
more information is in README file
there is NAnt build file - use latest snapshot of NAnt:
http://nant.sourceforge.net0 -
I'm sorry, but I'm having problems compiling your example. I noticed that you are using C# generics in your code, that is, C# version 2. Note that Ice is neither tested nor supported with that version.
I'm afraid it would be a lot of work for me to pare down your example to something small and self-contained. Could you get this down to something smaller and simpler? Also, if you can supply a line number and stack trace for where you think the problem is occuring, that would be useful.
Thanks,
Michi.0 -
Not adding anything useful but the OP mentioned that he:
" tried it both on Mono 1.1.8.2 on linux and .NET Framework 2.0 beta 2 on Windows - both have the same error"
Ice is anyway unsupported on .NET 2.0 beta or otherwise. You are probably running into some latent bug that got fixed in the later version.0 -
Much more smaller example
I am attaching example of this bug that I tested both with .NET 2 Beta 2 and .NET 1.1, both with the same exception:
CSStructAsClassProblemClient.exe: unknown exception: System.NullReferenceExcepti
on: Odkaz na objekt není nastaven na instanci objektu.
at CSStructAsClassProblem._testDelM.getSockets(Context __context) in c:\Docum
ents and Settings\michal.DESKBOOK\xdevelop\projects\IceCSStructAsClass\IceCSStru
ctAsClassHelper\CSStructAsClassProblem.cs:line 1139
at CSStructAsClassProblem.testPrxHelper.getSockets(Context __context) in c:\D
ocuments and Settings\michal.DESKBOOK\xdevelop\projects\IceCSStructAsClass\IceCS
StructAsClassHelper\CSStructAsClassProblem.cs:line 943
at CSStructAsClassProblem.testPrxHelper.getSockets() in c:\Documents and Sett
ings\michal.DESKBOOK\xdevelop\projects\IceCSStructAsClass\IceCSStructAsClassHelp
er\CSStructAsClassProblem.cs:line 930
at CSStructAsClassProblem.Client.run(String[] args) in c:\Documents and Setti
ngs\michal.DESKBOOK\xdevelop\projects\IceCSStructAsClass\Client\Client.cs:line 2
1
at Ice.Application.main(String[] args, String configFile)0 -
Thanks muchly for the code, I've managed to reproduce the problem. It's caused by a bug in the generated code. I'm working on a fix and I'll post a patch as soon as possible.
Cheers,
Michi.0 -
Here is a patch for the problem:
diff -c -r1.36 CsUtil.cpp *** CsUtil.cpp 18 Aug 2005 23:47:59 -0000 1.36 --- CsUtil.cpp 26 Aug 2005 02:25:22 -0000 *************** *** 777,782 **** --- 777,786 ---- out << sb; if(isArray) { + if(st->hasMetaData("cs:class")) + { + out << nl << param << "[__ix] = new " << typeS << "();"; + } out << nl << param << "[__ix].__read(" << stream << ");"; } else
Please apply that and let me know whether that fixes your problem.
Cheers,
Michi.0