I'm trying to use a webclient inside a task, see for code: http://stackoverflow.com/questions/42265198/cannot-get-webclient-downloadstring-to-download-inside-a-task-on-mono
The WriteLines are only to indicate where the task was delaying. The string is not returned and so "5" is not displayed. Instead I only receive timeouts. Why is this happening? It works without a hitch on .Net framework 4.5. It does not work on mono linux nor windows.
var urls5 = urls.Take(100);
var elapsed5 = Test<WebClient>(urls5);
Console.WriteLine("Webclient:" + elapsed5);
static TimeSpan Test<T>(IEnumerable<string> urls) where T : WebClient, new()
var sw = new System.Diagnostics.Stopwatch();
var tasks = new List<Task>();
foreach (var u in urls)
using (var wc = new T())
var str = wc.DownloadString(u);
var hap = new HtmlAgilityPack.HtmlDocument();
var asdf = hap.DocumentNode.InnerText + " ";
A little background info, the HtmlAgilityPack code is part of a bigger project trying to trackdown what I think is a further issue where code pulling and processing data appears to be significantly faster on Windows than linux/mono (on a server where wget can pull the data down at blistering speeds). This is a separate issue that I will focus on after this issue is dealt with.
Could you attach complete repro we can use to reproduce?