Ticket #19 (closed defect: fixed)
Wrong VTABLE IPersistStream
Reported by: | jasper | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | Per-user or per-machine installations |
Component: | TLB/PIA installer x86 | Version: | 2.0 |
Keywords: | PIA IPersistStream | Cc: |
Description
Decompiling the interface, I see
#region Assembly CAPE-OPENv1-1-0.dll, v1.1.0.0
C:\Program Files (x86)\Common Files\CAPE-OPEN\Reference Assemblies\CAPE-OPENv1-1-0.dll
#endregion
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
namespace CAPEOPEN
{
[ComVisible(false)]
[Guid("00000109-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IPersistStream : IPersist
{
void GetSizeMax(out long pcbSize);
int IsDirty();
void Load(IStream pStm);
void Save(IStream pStm, bool fClearDirty);
}
}
The propert VTABLE order is {IsDirty,Load,Save,GetSizeMax}. As a result attempting to call Save actually calls GetSizeMax in the above interface.
Change History
comment:2 Changed 6 years ago by michaelhalloran
- Status changed from new to closed
- Resolution set to fixed
This issue was fixed in September 2016 and included in the September 2016 release of the Type Library and PIA Installers available on the downloads page. The issue was caused by the fact that COM interface inheritance is not supported in .NET so IPersist::GetClassID was missing from IPersistStream and other interfaces. The fix adds GetClassID in explicitly to generate a correct vtable.
After fixing follow up with the CAPE-OPEN forum topic on this issue at:
http://cape-open-forum.org/viewtopic.php?f=17&p=1694#p1694