This document describes the PX1013 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1013 | The action handler that initiates a background operation or is executed by a background operation must return IEnumerable . |
Error | Available |
To work properly with background operations, the action handler must return IEnumerable
. If you use the void
action handler, the processing of the long-running operation and its result will not be displayed in the UI.
The code fix changes the return type to IEnumerable
.
public class SMUserProcess : PXGraph
{
public PXSelect<Users> Users;
public PXAction<Users> SyncMyUsers;
[PXButton]
[PXUIField]
public virtual void syncMyUsers() // The PX1013 error is displayed for this line.
{
SyncUsers();
}
private void SyncUsers()
{
PXLongOperation.StartOperation(this, () => Console.WriteLine("Synced"));
}
}
public class SMUserProcess : PXGraph
{
public PXSelect<Users> Users;
public PXAction<Users> SyncMyUsers;
[PXButton]
[PXUIField]
public virtual IEnumerable syncMyUsers(PXAdapter adapter)
{
SyncUsers();
return adapter.Get();
}
private void SyncUsers()
{
PXLongOperation.StartOperation(this, () => Console.WriteLine("Synced"));
}
}