Archived

This forum has been archived. Please start a new discussion on GitHub.

ice-3.3.0-VC90: enumerator out of range

I need some help to understand the following problem.

My Ice application and its test harness were ported to Visual Studio 2008 and Ice-3.3.0-VC90. The Ice definition files for my application were compiled into a static C++ library which both link to. The issue I ran into is the test harness cannot communicate to the Ice application due to the following error:

Ice::MarshalException
BasicStream.cpp:450: Ice::MarshalException:
protocol error: error during marshaling or unmarshaling:
enumerator out of range
at file (BasicStream.cpp)
at line number (450)
..\SWAVTest.exe: BasicStream.cpp:450: Ice::MarshalException:
protocol error: error during marshaling or unmarshaling:
enumerator out of range

By running the test harness in debug mode, I was able to trace down to following calling stack:

> msvcp90d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & _Right={...}) Line 734
msvcr90d.dll!_CxxThrowException(void * pExceptionObject=0x0012f1e4, const _s__ThrowInfo * pThrowInfo=0x10349d34) Line 161
ice33d.dll!IceInternal::BasicStream::write(unsigned char v='Í', int end=2) Line 450 + 0x48 bytes

Comments

  • bernard
    bernard Jupiter, FL
    Hi Deqing,

    This exception indicates that you're trying to write (or that you're receiving) an enumerator outside the range of a Slice enum. Your stack trace shows that you're writing this enumerator (while marshaling a request or response).

    Further frames in your stack trace should show you which operation invocation (or implementation) is triggering this exception.
    ice33d.dll!IceInternal::BasicStream::write(unsigne d char v='Í', int end=2)
    

    This shows you have an enum with 3 values, such as enum Color { White, Red, Blue }, and you're passing 'Í' (the value depends on your character encoding: it's 205 if you're using ISO Latin 1). Maybe an uninitialized parameter?

    Best regards,
    Bernard
  • bernard
    bernard Jupiter, FL
    205 == 0xCD ... since you're using Visual C++, an uninitialized value seems very likely. See CRT Debug support - The Magic Memory values. « Visual C++ Tips

    Best regards,
    Bernard
  • Hi Bernard,

    Thank you for the prompt replies. You were right on the money. What worked in VC2005 and Ice-3.2.0 doesn't necessarily work in VC2008 and Ice-3.3.0-VC90. It seems that there are more runtime checks in place.

    Thanks again,
    Deqing