BUG: get_Version returns S_OK even if the version does not exist (248194)
The information in this article applies to:
- Microsoft Visual SourceSafe for Windows 5.0
- Microsoft Visual SourceSafe for Windows 6.0
This article was previously published under Q248194 SYMPTOMS
When trying to get a specific version of a file or project, the get_Version function returns successfully and has a valid item even if that item does not exist in the database.
RESOLUTION
Instead of checking the HRESULT or whether the IVSSItem is not null, check the get_VersionNumber after calling get_Version. Compare the version numbers to make sure the version is valid. For example, place the following code inside the pVdb->get_VSSItem if statement:
// Used to store the latest version number of the item
long originalnumber, num;
// Store the latest version number of the item
vssi->get_VersionNumber(&originalnumber);
// Get the version at the label (this label will fail)
CComVariant varLabel = -51;
vssi->get_Version(varLabel, &vx);
// Get the version number of the returned item
vx->get_VersionNumber(&num);
// Compare the versions and see if the item is valid
if ( num > 0 && num <= originalnumber )
printf("Valid label.");
// Release the item
vx->Release(); STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.REFERENCES
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
196197
You receive an error message when you get a file from a project label by using OLE automation
Modification Type: | Major | Last Reviewed: | 7/20/2005 |
---|
Keywords: | kbAutomation kbBug kbnofix KB248194 kbAudDeveloper |
---|
|