LiveConnectClient | DownloadAsync崩溃,没有例外

时间:2013-12-31 12:21:26

标签: c# windows-phone-8 async-await live-sdk

WP8,VS 2013 Live SDK(nuget)v5.5

private async void DownLoadImageFromSkyDrive(string imgUrl, Int32 number)
{
    LiveConnectClient client = new LiveConnectClient(_currentSession);
    var image = await client.DownloadAsync(imgUrl + "/content");
    BitmapImage bitmap = new BitmapImage();
    bitmap.SetSource(image.Stream);
}

执行

var image = await client.DownloadAsync(imgUrl + "/content");

callstack位于父函数中。没有例外,但是

BitmapImage bitmap = new BitmapImage();

未执行。 代码工作....

1 个答案:

答案 0 :(得分:1)

或尚未执行...您的函数是async方法,没有返回值。它不会阻止来电者。另外我相信async void不会将异常传递给调用者。将try catch块放在DownLoadImageFromSkyDrive中,看看发生了什么。