id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 3234,XML Serialization error when loading class that inherits from wstring,nitram.cero@…,Robert Ramey,"Using version 1.37.0, but checked against SVN and it doesn't seem to have changed a lot. I'm sorry and I'll try the latest boost version, but please do not disregard this bug just because of the version. I've tested up until I reach basic_text_iprimitive::load(wstring &t): {{{ template void load(T & t) { if(is.fail()) boost::serialization::throw_exception( archive_exception(archive_exception::stream_error) ); is >> t; } }}} The value was ""./"" In this case t = ""./"" :-O (basePath thas the NVP name for the wstring value) As the end tag is taken as the actual value, trying to get the end tag will break the serialization when continuing the execution. Call stack: {{{ CharacterEditor.exe!boost::archive::basic_text_iprimitive > >::load(nt::wstring & t={...}) Line 87 C++ CharacterEditor.exe!boost::archive::xml_wiarchive_impl::load(nt::wstring & t={...}) Line 63 C++ CharacterEditor.exe!boost::archive::load_access::load_primitive(boost::archive::xml_wiarchive & ar={...}, nt::wstring & t={...}) Line 98 C++ CharacterEditor.exe!boost::archive::detail::load_non_pointer_type::load_primitive::invoke(boost::archive::xml_wiarchive & ar={...}, nt::wstring & t={...}) Line 306 + 0xd bytes C++ CharacterEditor.exe!boost::archive::detail::load_non_pointer_type::invoke(boost::archive::xml_wiarchive & ar={...}, nt::wstring & t={...}) Line 391 + 0xd bytes C++ CharacterEditor.exe!boost::archive::load(boost::archive::xml_wiarchive & ar={...}, nt::wstring & t={...}) Line 514 + 0xd bytes C++ CharacterEditor.exe!boost::archive::detail::common_iarchive::load_override(nt::wstring & t={...}, int __formal=0) Line 59 + 0x15 bytes C++ CharacterEditor.exe!boost::archive::basic_xml_iarchive::load_override(const boost::serialization::nvp & t={...}, int __formal=0) Line 82 C++ > CharacterEditor.exe!boost::archive::xml_wiarchive_impl::load_override const >(const boost::serialization::nvp & t={...}, int __formal=0) Line 79 C++ . . . . }}} nt::string is almost the same as std::wstring {{{ namespace nt { class wstring : public std::wstring { /*some extra helper functions for initialization from a wxWidgets' wxString*/} } BOOST_CLASS_IMPLEMENTATION(nt::wstring, boost::serialization::primitive_type) namespace boost { namespace serialization { template void serialize(Archive & ar, nt::wstring &s, const unsigned int version) { ar & static_cast(s); } } } // namespace serialization // namespace boost }}} The compiler is Microsoft Visual C++ Express 2008 (9) I did this hacks in order to get serialization templates to work under MSVC9: {{{ //HACK: enable serialization of MSVC9 hash_map #define BOOST_HAS_HASH #define BOOST_HASH_MAP_HEADER //HACK: disable resize of hash_map #define __MWERKS__ #include #undef __MWERKS__ #include }}} Thanks for your time. -Martín ",Bugs,closed,Boost 1.40.0,serialization,Boost Development Trunk,Problem,wontfix,serialization wstring derived class,