private static Result CloseImpl(IntPtr thisPtr, IntPtr pData) { try { IncludeShadow shadow = ToShadow <IncludeShadow>(thisPtr); Include callback = (Include)shadow.Callback; if (shadow._frames.TryGetValue(pData, out Frame frame)) { shadow._frames.Remove(pData); callback.Close(frame.Stream); frame.Dispose(); } return(Result.Ok); } catch (SharpGenException exception) { return(exception.ResultCode.Code); } catch (Exception) { return(Result.Fail); } }