public int PerformSort(string paginationMode, string sortId, SortOptions sortDirection, bool clearSort, out string uniqueName)
        {
            this.SetProcessingCulture();
            ControlSnapshot snapshot = this.m_executionSession.Snapshot;

            try
            {
                this.m_executionSession.Snapshot = new ControlSnapshot();
                snapshot.PrepareExecutionSnapshot(this.m_executionSession.Snapshot, null);
                using (ProcessingStreamHandler @object = new ProcessingStreamHandler())
                {
                    this.m_itemContext.RSRequestParameters.PaginationModeValue = paginationMode;
                    ReportProcessing  reportProcessing = this.CreateAndConfigureReportProcessing();
                    ProcessingContext pc = this.CreateProcessingContext(@object.StreamCallback);
                    AspNetCore.ReportingServices.ReportProcessing.RenderingContext rc = this.CreateRenderingContext();
                    int result = default(int);
                    OnDemandProcessingResult onDemandProcessingResult = reportProcessing.ProcessUserSortEvent(sortId, sortDirection, clearSort, pc, rc, (IChunkFactory)snapshot, out uniqueName, out result);
                    if (onDemandProcessingResult != null && onDemandProcessingResult.SnapshotChanged)
                    {
                        this.m_executionSession.SaveProcessingResult(onDemandProcessingResult);
                    }
                    else
                    {
                        this.m_executionSession.Snapshot = snapshot;
                    }
                    return(result);
                }
            }
            catch
            {
                this.m_executionSession.Snapshot = snapshot;
                throw;
            }
        }
        private void OnGetSubReportDefinition(ICatalogItemContext reportContext, string subreportPath, string newChunkName, ReportProcessing.NeedsUpgrade upgradeCheck, ParameterInfoCollection parentQueryParameters, out ICatalogItemContext subreportContext, out string description, out IChunkFactory chunkFactory, out ParameterInfoCollection parameters)
        {
            if (reportContext == null)
            {
                throw new ArgumentException("OnGetSubReportDefinition: Invalid report context");
            }
            if (upgradeCheck(ReportProcessingFlags.OnDemandEngine))
            {
                throw new Exception("Subreport definition is not compatible with this version of viewer controls");
            }
            subreportContext = reportContext.GetSubreportContext(subreportPath);
            ControlSnapshot  controlSnapshot = default(ControlSnapshot);
            PublishingResult compiledReport  = this.GetCompiledReport((PreviewItemContext)subreportContext, false, out controlSnapshot);

            controlSnapshot.PrepareExecutionSnapshot(this.m_executionSession.Snapshot, newChunkName);
            description  = compiledReport.ReportDescription;
            chunkFactory = controlSnapshot;
            parameters   = compiledReport.Parameters;
        }