Sunday, October 27, 2013

Issue with StorageFile.GetFileAsync

I suspect you're deadlocking when you block waiting on Task.Result. If you use await instead you shouldn't have a problem. You should be able to see this in the debugger by examining the threads calling and implementing GetFileStream.


Instead of:



byte[] a = GetFileStream(filename).Result;

do:

byte[] a = await GetFileStream(filename);



--Rob

No comments:

Post a Comment