[V8i C#] How to get ErrorInstances and Exceptions when Post Features whit GDIInstanceProcessor


I try to Post (commit) new, modified or deleted features.

Post Command work well but I'm going to catch ErrorFeatures and Exceptions when command is finish.

My code is

public void PostSelected()
                if (null != StorageImportCriteria)
                    GDIPostProcessor postProcessor = new GDIPostProcessor()
                        ShowProgress = true,
                        UnlockAfterSuccessfulPost = true,
                        ShowCompleteMessage = true,
                        UnsuccessfulMergeAction = GDIPostProcessor.UnsuccessfulMergeActions.Prompt,
                        PartialPostingEnabled = true

                    StorageImportCriteria.Import.SpatialArea = SpatialArea.Selection;
                    postProcessor.ReportException += PostProcessor_ReportException;
protected override void OnReportException(Exception ex)

  • Nikolay,

    The following should check for and iterate through any posting errors.

                // Check for and report any errors that may have occurred.
                if (postProcessor.ErrorInstances != null && postProcessor.ErrorInstances.Count > 0)
                    System.Text.StringBuilder builder = new System.Text.StringBuilder();
                    foreach (IECInstance errorInstance in postProcessor.ErrorInstances)
                        Exception ex = GeoDataInterchangeAddIn.GetExceptionFromErrorInstance(errorInstance);
                        builder.AppendLine(string.Format("Error instance: {0}, class: {1}, message: {2}", errorInstance.InstanceId, errorInstance.ClassDefinition.Name, 
                            ex != null ? ex.Message: string.Empty));
                    GeoDataInterchangeAddIn.ReportError("Exceptions occurred when posting, see Message details", builder.ToString(), true);


    Jeff Bielefeld [Bentley]