locked
Asynchronous method (await keyword) RRS feed

  • Question

  • I have this method (ImageOwnerInf),when I call it from another method it reach to /**/ point ,then return to the caller method and execute the code below the call statement that depends on the method(ImageOwnerInf).
     I think it is a deadlock.
    I tried to use ConfigureAwait(false) but it did not make any change.
    What is the solution to let my code work sequentially although that await is exist ,please?
    private static async void ImageOwnerInfo(ParseObject x)
          {              ..................
                        foreach (ParseFile Photo in Photos)
                        {
                            if (Photo != null)
                            {
                           /**/   byte[] data = await new HttpClient().GetByteArrayAsync(Photo.Url);
                                BitmapImage image = await ByteArrayToBitmapImage(data).ConfigureAwait(false);
                                ListOfImages.Add(image);
                            }
                        }
                        ImagesAsSource.Add(x.ObjectId, ListOfImages);

        }

    }
    Saturday, December 14, 2013 2:53 PM

Answers