我有一个像下面这样的课
public class ImageUploader
{
....
public Task<string> Upload()
{
return new Task<string>(
() =>
{
....
return UploadedFilePath;
}
);
}
....
}
然后我像这样使用它
var uploadIcon = new ImageUploader();
var uploadLogo = new ImageUploader();
var uploadIconTask = uploadIcon.Upload();
var uploadLogoTask = uploadLogo.Upload();
Task.WaitAll(uploadIconTask, uploadLogoTask); // never returns
和 Task.WaitAll 永远挂起!
问题是什么?!