我正在使用 C# 异步 CTP 调用一些返回 URI 的远程函数,我有以下代码:
public async Task<Uri> GetUriAsync(string service, string endpoint)
{
Uri result = null;
foreach (var service in _serviceProvider)
{
try
{
result = await service .GetAsync(service,endpoint);
if (result != null)
return result;
}
catch (Exception)
{
}
}
return result;
}
由于foreach内部有await,所以这个方法应该在第一个await中返回,但是通过调试我注意到当代码到达await时它会跳转到“return result”
我之前使用过 async ctp(不是在 windows phone 上)并完成了与此类似的代码。
那有什么问题呢?
编辑:这不是调试器错误/错误,因为远程调用从未完成(我在那里有一个日志)。