I'm using the C# async CTP to call some remote functions that return me a URI, I have the following code:
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;
}
Since there is a await inside the foreach, this method should return in the first await, but by debugging I noticed that when the code reachs the await it jumps to "return result"
I've used async ctp before (not on windows phone) and done code similar to this one.
What is wrong in that?
EDIT: This isn't the debugger error/bug, since the remote call is never done (I have a log in there).
The problem was an internal exception at AsyncCtp dll. It seams that the debugger categorizes this exceptions as First Chance exception and decide not to abort the debug session. By doing the code runs normally but without doing the web request (in this case) leaving the developer to think that everything is ok.
Thanks for the help @Reed.