Skip to main content

Hi there, 

we have a customization where we have overridden the GetBucketForImport method in BCSalesOrderProcessor.cs graph. After overridden we are facing issue at await keyword.

Please refer the below screenshots and code.

Overridden code:

 public delegate Task<EntityStatus> GetBucketForImportDelegate(BCSalesOrderBucket bucket, BCSyncStatus syncstatus, CancellationToken cancellationToken);
PXOverride]
public async Task<EntityStatus> GetBucketForImport(BCSalesOrderBucket bucket, BCSyncStatus syncstatus, CancellationToken cancellationToken, GetBucketForImportDelegate baseMethod)
{
OrderData data = await orderDataProvider.GetByID(syncstatus.ExternID);
if (data == null) return EntityStatus.None;

await Task.Yield();
data.OrderProducts = new List<OrdersProductData>();
await foreach (var item in orderProductsRestDataProvider.GetAll(syncstatus.ExternID, cancellationToken))
{

data.OrderProducts.Add(item);
}

MappedOrder obj = bucket.Order = bucket.Order.Set(data, data.Id?.ToString(), data.Id?.ToString(), data.DateModifiedUT.ToDate());

EntityStatus status = Base.EnsureStatus(obj, SyncDirection.Import);

if (status != EntityStatus.Pending && status != EntityStatus.Synchronized && Base.Operation.SyncMethod != SyncMode.Force)
return status;

return status;
}

Base code screenshot:

Thanks in advance.

I think you are working on the customization in 2024R1, the issue is the C# version in your project is 7.3, you have to change the project file and set to 8.0 or later version:

<PropertyGroup>

          <LangVersion>8.0</LangVersion>
</PropertyGroup>


Reply