Why app crashes when the second call to DownloadStringTaskAsync?

Hi all. The application flies in the UnhandledException in the second call to this function.
public static class Locator
{
 public static async Task<list<location>> GetCitiesAsync(string token = "", int max = 5)
{
 WebClient wc = new WebClient();
 string resultContent = await wc.DownloadStringTaskAsync(new Uri(string.Format("http://www.site.ru/ajax/geo.cshtml?_=r&context=&token={0}&max_matches={1}&use_similar=0", HttpUtility.UrlEncode(token), max.ToString())));
 // parse ...

 Locations ll = JsonConvert.DeserializeObject<locations>(resultContent);

 return (from l in ll.locations select l).Take(max).ToList();
}
 }</locations></list<location>


Cause so
async void LocationsFunc(string search)
{
 if (IsLoading)
return;

 IsLoading = true;
 List<location> locs = await Locator.GetCitiesAsync(search);
 IsLoading = false;
}</location>


A first chance exception of type 'System.Exception' occurred in System.Windows.dll
A first chance exception of type 'Ms. Internal.WrappedException' occurred in System.Windows.dll
A first chance exception of type 'Ms. Internal.WrappedException' occurred in System.Windows.dll
A first chance exception of type 'Ms. Internal.WrappedException' occurred in System.Windows.dll


try/catch does not help, wherever he is.
I'll never know, what's the matter? Why would he care? It creates a new instance WebClientŠ°
In callback/event style of writing it works.
September 19th 19 at 12:55
2 answers
September 19th 19 at 12:57
And even that did not work?
if (IsLoading)
return;
try {
 IsLoading = true;
 List<location> locs = await Locator.GetCitiesAsync(search);
} catch (Exception ex) {
Debug.Break();
 // MessageBox there would be some kind or record in log
} finally {
 IsLoading = false;
}</location>
September 19th 19 at 12:59
Very strange, but now the code is from my starting post earned.. yesterday I fixed it by replacing the line
List locs = await Locator.GetCitiesAsync(search);
on
foreach (Location loc in await Locator.GetCitiesAsync(search))
...
and it worked. Apparently the whole point was to bind Take to any local variable. try/catch'AMI wrapped everything, but nothing was caught, but just fell.. the Emulator to restart not tried it, maybe it's somewhere in the depths of the system..

Find more questions by tags Asynchronous programmingC#.NETWindows Phone