Esri / Esri/datareviewer-customcheck-samples

Data Reviewer API issue under citrix enviroment.

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3
Forks
2
PR merge metrics
No merged PRs in 30d

Description

I have an issue in Data Reviewer API.
I have a code to write custom results to Data Reviewer tables using the API. The code is working fine however when lunched from citrix , it is giving the following execption :
9/7/2017 11:31:41 AM
********************************
Line Number: 0
File Name:
Method Name: ESRI.Production.Engine.IPLTSProcessingErrorCollection WriterReviewerResults(ESRI.Production.Engine.IRevSession, ESRI.Production.Engine.IRevResultEnum, Boolean, Boolean, Boolean, Boolean, ESRI.Production.Engine.reviewerResultsContext)
SaveResultsToRevTable_Writing
-------------------------------------

Message=External component has thrown an exception.

StackTrace= at ESRI.Production.Desktop.ReviewerResultsWriterClass.WriterReviewerResults(IRevSession ipRevSession, IRevResultEnum ipRevErrors, Boolean vblnShowProgressBar, Boolean vblnShowResults, Boolean vblnShowErrors, Boolean vblnCheckForDuplicates, reviewerResultsContext eResultsContext)
at KA.QAQCFramework.GISManager.MainManager.SaveResultsToRevTable(List`1 results, Int32 userSessionID, String versionName)

Exception=System.Runtime.InteropServices.SEHException: External component has thrown an exception.
at ESRI.Production.Desktop.ReviewerResultsWriterClass.WriterReviewerResults(IRevSession ipRevSession, IRevResultEnum ipRevErrors, Boolean vblnShowProgressBar, Boolean vblnShowResults, Boolean vblnShowErrors, Boolean vblnCheckForDuplicates, reviewerResultsContext eResultsContext)
at KA.QAQCFramework.GISManager.MainManager.SaveResultsToRevTable(List`1 results, Int32 userSessionID, String versionName)

Code is :
public int CreateReviewerSession(string userName, string versionName, CheckEventEnum runEvent)
{
try
{
IWorkspace workSpace = LocalGlobalContext.Workspace;
RevSessionManager revSessionMan = new RevSessionManager();
IRevSession session = revSessionMan.NewRevSession(workSpace, workSpace, versionName, userName, userName + " " + versionName, null);
session.SessionName = userName + " " + versionName + " " + runEvent.ToString();
return session.SessionID;
}
catch
{
return -1;
}
}


public int SaveResultsToRevTable(List results, int userSessionID, string versionName)
{
//Since if there is no opened session in arcmap datareviewer will not write.
if (LocalGlobalContext.Application == null)
{
return -1;
}
IExtensionManager ipExtManager = LocalGlobalContext.Application as IExtensionManager;
IExtension ipExt = ipExtManager.FindExtension("{4d8c99bc-5096-406c-b48a-0581399add77}");
IReviewerExtension ipRevExtension = ipExt as IReviewerExtension;
if (ipRevExtension != null)
{
try
{

IWorkspace workSpace = LocalGlobalContext.Workspace; //ChildExtension.GetMainExtension().get_GetWorkSpace();// GlobalContext.Instance.Workspace;
// load user session
RevSessionManager revSessionMan = new RevSessionManager();

try
{
//In case of exception.
revSessionMan.ContainsReviewerDataset(workSpace);
}
catch (Exception ex)
{
if (ChildExtension.GetMainExtension() != null && ChildExtension.GetMainExtension().get_GetWorkSpace() != null)
{
workSpace = ChildExtension.GetMainExtension().get_GetWorkSpace();
}
revSessionMan.ContainsReviewerDataset(workSpace);
CommonErrorLog.LogExceptionDetailedToEventLog(CommonErrorLog.EventKeyName, CommonErrorLog.sourceName, ex,"Re initializing workspace");

}

IWorkspace adinWorkSpace = revSessionMan.GetAdminWorkspace(workSpace);
IRevSession m_RevSession = revSessionMan.LoadRevSession(workSpace, adinWorkSpace, userSessionID, versionName, null, null);
//added 10/9/2015
ipRevExtension.StopSession();
// this container will hold the errors we will be writing to the table
ipRevExtension.StartSession(m_RevSession);
m_RevSession.RevTable.StartEditing();
m_RevSession.RevTable.StartEditOperation();
//string whereClause = "SESSIONID = " + userSessionID + " AND ( UPPER(REVIEWSTATUS) <> 'CORRECTED' OR REVIEWSTATUS is null )"; // AND PARAMETERS = '+ results[0].CheckEventString +'
string whereClause = "SESSIONID = " + userSessionID + " AND ( UPPER(CORRECTIONSTATUS) NOT LIKE 'RESOLVED%' OR CORRECTIONSTATUS is null )"; // AND PARAMETERS = '+ results[0].CheckEventString +'
if (LocalGlobalContext.OverWriteDRSessions)
{
m_RevSession.RevTable.DeleteQueriedRows(new QueryFilterClass() { WhereClause = whereClause });
//m_RevSession.RevTable.DeleteQueriedRows(new QueryFilterClass() { WhereClause = "CORRECTIONSTATUS is null" });
}

m_RevSession.RevTable.StopEditOperation();
m_RevSession.RevTable.StopEditing(true);

// ipRevExtension.ReviewerSession.RevTable.DeleteQueriedRows(new QueryFilterClass() { WhereClause = "SESSIONID = " + userSessionID });

IRevResultEnum ipResultEnum = new RevResultEnumClass();
foreach (var result in results)
{
IRevResult ipResult = CreateReviewerRecord(result);
ipResultEnum.Append(ipResult);
}
//Write Reviewer results to Reviewer workspace
IReviewerResultsWriter ipRevResultsWriter = new ReviewerResultsWriterClass();
//Use a Reviewer result context.
//Reviewer Result Context is an enumeration defining the context from where results are written to Reviewer table
reviewerResultsContext eResultContext = reviewerResultsContext.reviewerManualCheck;

//ipRevExtension.ReviewerSession.RevTable.DeleteQueriedRows(new QueryFilterClass() { WhereClause = "SESSIONID = " + userSessionID });
//WriterReviewerResults method Arguments explained
//1. Active Reviewer Session : Reviewer Session
//2. IRevResultEnum : Reviewer Results Enumeration
//3. ShowProgressBar(bool) : Indicate progress of writing results to Reviewer workspace.
//4. Show Results(bool) : Display messages after completion of writing results.
//5. Show Errors(bool) : Display errors(ifany) after writing results.
//6. Check Duplicates(bool): Indicates if duplicates have to be checked while writing Reviewer results
//7. Reviewer Result Context : An enumeration defining the context from where results are written to Reviewer table

IPLTSProcessingErrorCollection ipWriteErrors = ipRevResultsWriter.WriterReviewerResults(m_RevSession, ipResultEnum, true, true, true, true, eResultContext);

//add 11/9/2016
try
{
//Reviewer button."{2A613717-BFAB-43A9-A9AD-CF1A24D2D3AD}"
ESRI.ArcGIS.Framework.ICommandItem barItem = default(ESRI.ArcGIS.Framework.ICommandItem);
ESRI.ArcGIS.Framework.ICommandBars pCommandBars = ChildExtension.GetMainExtension().EsriDocument.CommandBars;
ESRI.ArcGIS.esriSystem.UID pUID = new ESRI.ArcGIS.esriSystem.UID();
pUID.Value = "{2A613717-BFAB-43A9-A9AD-CF1A24D2D3AD}";
//"esriEditor.RefreshVersionCommand"
barItem = pCommandBars.Find(pUID, false, false);
if (barItem != null)
{
barItem.Execute();
}
}
catch (Exception ex)
{
}
//end add

return ipResultEnum.Count;
}
catch (Exception ex)
{
//return -1;
throw ex;
}
}
return -1;
}

private IRevResult CreateReviewerRecord(CheckResult result)
{
IRevResultSpecification ipResultSpec = new RevResultSpecificationClass();
ipResultSpec.CheckTitle = result.CheckName;
ipResultSpec.CheckName = result.CheckName;
ipResultSpec.RevStatus = "error detected";
ipResultSpec.UserName = result.UserName;
ipResultSpec.ErrorClass = reviewerErrorClass.reviewerECFeatureError;
ipResultSpec.ErrorType = (int)reviewerErrorType.reviewerETUserDefined;
ipResultSpec.Notes = result.ErrorMessage;
ipResultSpec.Parameters = result.CheckEventString;
ipResultSpec.Severity = (int)result.Severity;
// this helper class is used to make result configuration easier
IRevResultHelper ipResultHelper = new RevResultHelperClass();
// this will contain the error for the current feature
IRevResult ipResult = new RevResultClass();
try
{
// we set the result specification here
ipResult.RevErrorSpecification = ipResultSpec;
IRevResource ipFeatureResource = new RevResourceFeatureClass();
ipFeatureResource.Resource = result.Feature;
IFeature ftr = (result.Feature as IFeature);
// ipResultHelper.AddFeatureResultProperties(ipResult, result.Feature.ShapeCopy, ipFeatureResource);
ipResultHelper.AddFeatureResultProperties(ipResult, ftr.ShapeCopy, ipFeatureResource);
}
catch (Exception ex)
{
CommonErrorLog.LogExceptionDetailedToEventLog(CommonErrorLog.EventKeyName, CommonErrorLog.sourceName, ex, "");
}
return ipResult;
}

The exception is occurring at this method which is an ESRI API method :
ESRI.Production.Desktop.ReviewerResultsWriterClass.WriterReviewerResults

As mentioned above code is fully working using remote desktop and from the machine itself from citrix server however it is not working when lunching from citrix receiver.
Note: Code worked for once or twice when we cleared citrix cache but it stopped and even if we cleared citrix cache it is still not working.
Any help is much appreciated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.