Hi Everyone,
I'm currently converting some COM extensions to add-ins for our ArcMap 10.4 deployment but am stuck with a persistence issue.
Following the sample from here:ArcObjects 10 .NET SDK Help
private MyPersistentData _data;
protected override void OnLoad(Stream inStrm)
{
// Initialize the struct.
_data.Location = "";
_data.Point = new ESRI.ArcGIS.Geometry.PointClass();
PersistHelper.Load < MyPersistentData > (inStrm, ref _data);
}
protected override void OnSave(Stream outStrm)
{
PersistHelper.Save < MyPersistentData > (outStrm, _data);
}
[Serializable()]
private struct MyPersistentData
{
public string Location;
public ESRI.ArcGIS.Geometry.PointClass Point;
}
Utilizing the exact code in my add-in extension , I'm getting an error on the OnLoad routine.
- Cannot create uninitialized instance of types requiring managed activation.
Saving the custom object works fine and it also load fine when change the object to a just a point.I'm needing to saving multiple items hence the need for a custom object. I'm not sure how I can use the PersistenceHelper class to save everything that's needed.