S
S
Sasha Pleshakov2016-05-19 21:15:02
C++ / C#
Sasha Pleshakov, 2016-05-19 21:15:02

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];
            }
        }

And his challenge. Taken from there
FaceAttributes[] faceAttributes = await UploadAndDetectFaces(fileNames[0]);

25156d459d394733a9719064b5b4aa1a.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#algooptimize #bottize, 2016-05-19
@mnepoh

external method does not have async attribute async
void method() { await other_asyncmethod(); }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question