Answer the question
In order to leave comments, you need to log in
Why does an error appear when calling an async method?
Method taken from msdn
private async Task<FaceAttributes[]> UploadAndDetectFaces(string imageFilePath)
{
try
{
using(Stream imageFileStream = File.OpenRead(imageFilePath))
{
var faces = await faceServiceClient.DetectAsync(imageFilePath);
var faceAttributes = faces.Select(face => face.FaceAttributes);
return faceAttributes.ToArray();
}
}
catch (System.Exception)
{
return new FaceAttributes[0];
}
}
FaceAttributes[] faceAttributes = await UploadAndDetectFaces(fileNames[0]);
Answer the question
In order to leave comments, you need to log in
external method does not have async attribute async
void method() { await other_asyncmethod(); }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question