This document describes the PX1086 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1086 | PXSetupNotEnteredException cannot be thrown in long-running operations and processing delegates. |
Warning | Unavailable |
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.StartOperationmethods - The
ILongOperationManager.StartOperation,ILongOperationManager.StartAsyncOperation, andILongOperationManager.Awaitmethods - The
IGraphLongOperationManager.StartOperationandIGraphLongOperationManager.StartAsyncOperationmethods
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
PXGraphinitialization - In data view delegates
- In the
RowSelectedevent 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.
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();
}
}