Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 3.06 KB

File metadata and controls

63 lines (47 loc) · 3.06 KB

PX1086

This document describes the PX1086 diagnostic.

Summary

Code Short Description Type Code Fix
PX1086 PXSetupNotEnteredException cannot be thrown in long-running operations and processing delegates. Warning Unavailable

Diagnostic Description

The PX1086 diagnostic reports the PXSetupNotEnteredException exceptions thrown in long-running operations and processing delegates.

PXSetupNotEnteredException, which is used to prevent the opening of a form, cannot be thrown in long-running operations and processing delegates.

Long-running operations are started by the following APIs:

  • The PXLongOperation.StartOperation methods
  • The ILongOperationManager.StartOperation, ILongOperationManager.StartAsyncOperation, and ILongOperationManager.Await methods
  • The IGraphLongOperationManager.StartOperation and IGraphLongOperationManager.StartAsyncOperation methods

Processing delegates are delegates passed to the SetProcessDelegate and SetAsyncProcessDelegate methods of the PXProcessingBase<Table> class and its inheritors.

The PXSetupNotEnteredException exception can be thrown in the following places:

  • During the PXGraph initialization
  • In data view delegates
  • In the RowSelected event handlers

To fix this warning, you should remove the code that throws PXSetupNotEnteredException from the code of the long-running operation or the processing delegate and rework the related business logic.

Example of Incorrect Code

public class SMUserProcess : PXGraph
{
	public PXAction<Primary> Release = null!;
	
	public IEnumerable release(PXAdapter adapter)
	{
		PXLongOperation.StartOperation(() => throw new PXSetupNotEnteredException()); // The PX1086 warning is displayed for this line.
		return adapter.Get();
	}
	
	public PXAction<Primary> Report = null!;

	public IEnumerable report(PXAdapter adapter)
	{
		LongOperationManager.StartAsyncOperation(this, async cToken =>
		{
			throw new PXSetupNotEnteredException());								// The PX1086 warning is displayed for this line.
		});

		return adapter.Get();
	}
}

Related Articles