COBCH1925 The AWAIT expression does not return anything

The AWAIT expression has been used in a context where a returned value is expected, but the awaited task does not yield a result.

Resolution:

Correct the code to return a value.

Example:

The following example shows both correct and incorrect code as indicated:

      $set ilusing"System"
      $set ilusing "System.Threading.Tasks"
      $set sourceformat(variable)
       class-id A.
       method-id Main static.
           *> Demo 1
           invoke type Console::WriteLine("Awaiting call to long operation:");
           declare withAwaitAtCallTask = WithAwaitAtCallAsync()
           invoke withAwaitAtCallTask::Wait()
       end method.

       method-id WithAwaitAtCallAsync() private static async.
           invoke await type Task::Delay(1000);                *> Ok, Delay does not yield anything
           declare s as string = await type Task::Delay(1000); *> Error
       end method.
       end class.