Results 1 to 12 of 12

Thread: C#: Nested struct unmarshalling problem

  1. #1
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159

    C#: Nested struct unmarshalling problem

    I am passing a class by value, which has as a member a struct.
    On the other end, the struct arrives initialized to its default values, losing its member values. The method call works OK when I redefine the struct as a class, without changing anything else.

    These are the Slice definitions (the struct in question is 'Date'):

    Code:
    module IServices2ICE {
      . . .
    
      struct Date {
        byte Day;
        byte Month;
        short Year;
      };
    
      ["clr:property"]
      class PubDate {
        string Id;
        string PubKey;
        string ComboKey;
        ::IServices2ICE::Date Date;
        bool Cancelled;
        bool Produced;
      };
    
      sequence<PubDate> PubDateSeq;
      . . .
    }
    The class is actually passed in the form of a sequence (PubDateSeq).
    The Date member always arrives with its members set to 0.

    I can't see what I am doing wrong, so there is a chance of a bug.
    I hope though that this is my fault, as it would be a serious issue.

    The Ice version is 3.2.1.

    Karl
    Karl Waclawek

  2. #2
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    Thanks for the bug report! I'll have a look at what's wrong there.

    Cheers,

    Michi.

  3. #3
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    I've posted a patch for this. Thanks for reporting the problem!

    Cheers,

    Michi.

  4. #4
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159
    Quote Originally Posted by michi View Post
    I've posted a patch for this. Thanks for reporting the problem!

    Cheers,

    Michi.
    Thanks for the quick turnaround. it works now.
    Build question: The generated binaries are much larger than the original ones,
    using VS 2005 and your build instructions. I assume the default is a debug
    build. How do i configure your make file for a release build?

    Karl
    Karl Waclawek

  5. #5
    dwayne's Avatar
    dwayne is offline ZeroC Staff
    Name: Dwayne Boone
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Jan 2005
    Location
    St. John's, Newfoundland
    Posts
    397
    Edit config/Make.rules.mak.cs and comment out the DEBUG line and uncomment the OPTIMIZE line.

  6. #6
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    In terms of performance, an optimized build will basically make no difference. (At least, that's what I found last time I ran benchmarks and compared debug and optimized builds.)

    I have to admit that I never paid much attention to the difference in size. How much of a difference do you see?

    Whatever difference there is would be due mainly to the additional symbol information for debug builds. But I would hope that the symbol table would reside in a separate section in the assembly, so it wouldn't have to mapped into memory when the assembly is loaded. But I'm guessing here--anyone know for sure?

    Cheers,

    Michi.

  7. #7
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159
    Quote Originally Posted by michi View Post
    In terms of performance, an optimized build will basically make no difference. (At least, that's what I found last time I ran benchmarks and compared debug and optimized builds.)

    I have to admit that I never paid much attention to the difference in size. How much of a difference do you see?

    Whatever difference there is would be due mainly to the additional symbol information for debug builds. But I would hope that the symbol table would reside in a separate section in the assembly, so it wouldn't have to mapped into memory when the assembly is loaded. But I'm guessing here--anyone know for sure?

    Cheers,

    Michi.
    Actually, I am not talking about Ice for C#, but Ice for C++, as this is what I need to rebuild for your patches to slice2cs. The file size differences for slice2cs are: 308 KB for release, 764 KB for debug builds.

    Karl
    Karl Waclawek

  8. #8
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    Ah, OK, misunderstanding then. I thought you meant the size of the icecs.dll assembly.

    For C++, the executable size really doesn't matter, unless you care about disk space. The debug section in the executable is not loaded into memory at run time, so there is no additional overhead. Without optimization, slice2cs will run a tad slower, but not so that you would notice.

    Cheers,

    Michi.

  9. #9
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159
    Quote Originally Posted by michi View Post
    Ah, OK, misunderstanding then. I thought you meant the size of the icecs.dll assembly.

    For C++, the executable size really doesn't matter, unless you care about disk space. The debug section in the executable is not loaded into memory at run time, so there is no additional overhead. Without optimization, slice2cs will run a tad slower, but not so that you would notice.

    Cheers,

    Michi.
    The problem I actually had was that the debug builds would not run on the other developer's machines (they use slice2java), as they were missing the debug runtime libraries, msvcp80d.dll and msvcr80d.dll. On my machine there was no problem as I have VS 2005 installed.

    Karl
    Karl Waclawek

  10. #10
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    Ah, OK, that makes sense, yes.

    Cheers,

    Michi.

  11. #11
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Note that the debug Microsoft runtime DLLs are not redistributable ... that's why we don't include them in the Ice distribution. You should only distribute "release" binaries (built with /MD, not /MDd).

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  12. #12
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159
    Quote Originally Posted by bernard View Post
    Note that the debug Microsoft runtime DLLs are not redistributable ... that's why we don't include them in the Ice distribution. You should only distribute "release" binaries (built with /MD, not /MDd).

    Best regards,
    Bernard
    Yes, I know, but the default configuration of your build is for debug.

    Karl
    Karl Waclawek

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Nested Modules
    By Ryuga in forum Help Center
    Replies: 1
    Last Post: 02-25-2009, 05:18 AM
  2. slice2cs: struct/class unmarshalling problem
    By kwaclaw in forum Bug Reports
    Replies: 8
    Last Post: 10-12-2007, 10:26 AM
  3. A problem about struct of multi-items
    By klsmlzm in forum Help Center
    Replies: 4
    Last Post: 10-24-2006, 02:38 AM
  4. Problem with classes in struct
    By kovacm in forum Help Center
    Replies: 9
    Last Post: 10-06-2005, 01:49 AM
  5. Replies: 3
    Last Post: 03-25-2004, 12:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •