I have converted a VB6 project to C#, and there is one problem I cannot find documentation on. I am saving an IPropertySet
to file by using IMemoryBlobStream
and IPersistStream
, as seen here:
public void WriteToFile(string fullPath)
{
IMemoryBlobStream pMemStream;
IPersistStream pPersistStream;
try
{
// Open Stream, must use memory stream instead of FileStream
pMemStream = new MemoryBlobStreamClass();
// Write PropertySet to Stream
pPersistStream = (IPersistStream)m_pPropertySet;
pPersistStream.Save(pMemStream, 1);
// Save Stream to File
pMemStream.SaveToFile(fullPath);
pMemStream = null;
}
catch (Exception ex)
{
return;
}
}
I get an "HRESULT E_FAIL" with error code "-2147467259" on pPersistStream.Save(pMemStream, 1);
This doesn't throw an error if the PropertySet
is empty, only if it has properties within.
When the PropertySet
is populated, it is populated by Long data types (int64). Using PropertySet.SetProperty(Name, Value)
Any ideas why this would work great in ArcGIS 8/9 and not in 10 with C#?