FIX: CArchive::GetObjectSchema Returns Incorrect SchemaLast reviewed: December 1, 1997Article ID: Q173252 |
The information in this article applies to:
SYMPTOMSCArchive::GetObjectSchema returns the schema of the object loading the serialized information rather than the schema of the object being loaded. This occurs only when an object with a schema greater than 0 loads an object with a schema equal to 0 and the object being loaded is not the first of this type.
CAUSEWhen the first object of a type that has a schema of 0 is loaded, the value of the CArchive member, m_nObjectSchema, is set to a value of 0. When further objects of the same type are loaded, m_nObjectSchema is set to the schema of the object loading the serialized information. This behavior is due to the way CArchive::ReadClass determines the schema of a type that has already been stored. This is done in the following code located toward the end of CArchive::ReadClass:
// determine schema stored against objects of this type void* pTemp; if (m_pSchemaMap != NULL && (pTemp = m_pSchemaMap->GetValueAt(pClassRef)) != NULL) nSchema = (UINT)pTemp; else nSchema = pClassRef->m_wSchema & ~VERSIONABLE_SCHEMA;When the schema of a type that has already been loaded is 0 the value returned from GetValueAt is 0 and the else part of the if statement is executed. This sets the value of the schema for the object being loaded as the schema of the existing object.
RESOLUTIONThere are two ways to work around this issue:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been fixed in Visual Studio 97 Service Pack 3. For more information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q170365 TITLE : INFO: Visual Studio 97 Service Packs - What, Where, and Why Keywords : vcbuglist420 vcbuglist500 VS97FixlistSP3 Technology : kbMfc Version : WINDOWS NT:4.2,5.0 Platform : NT WINDOWS Issue type : kbbug Solution Type : kbfix kbservicepack |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |