I'm trying to use a standalone snap agent. Is that not possible?

Here's some code:

        // instantiate these agents.
        _snapSupportAgent = new FeatureSnapClass();
        _snapSupportAgent.FeatureClass = _parcelSplitLine;
        _snapSupportAgent.HitType = esriGeometryHitPartType.esriGeometryPartBoundary;

        _snapParcelAgent = new FeatureSnapClass();
        _snapParcelAgent.FeatureClass = _parcelSplitLine;
        _snapParcelAgent.HitType = esriGeometryHitPartType.esriGeometryPartBoundary;

Later on code:

        var newPoint = new PointClass();

When I do that, I get a nasty protected memory exception. I'm editing directly to a IWorkspaceEdit, without interference of the IEditor.

  • Did you try using IEngineSnapAgent instead? There's a sample here. Dec 15, 2012 at 17:20
  • I'll try that, but it's not an engine application. It's working under a custom form with a AxMapControl, true, but it's not ArcEngine... Dec 17, 2012 at 14:23

1 Answer 1


I can't find the documentation now, but AFAIK, Snapping can only be done using the ISnapEnvironment Interface via the IEditor.

The IFeatureSnap is used in two kinds of cases: Defining a custom snap agents or accessing the snap agents in the snap environment. It is the snap environment which actually does the snapping.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.