c# - WebException not occuring where it should? -


I have a piece of code that looks like this:

  var task = Work. Resource. STARTNU ((=) = & gt; {(BCI.Complete & amp; cts.Token.IscancellationRequested) {PreferencesDownloaded PEERPD; if (BCTTTech (Out PD)) {var baseUri = pd.Value .URI; Console.Procline ("({0}) {1}", PDKA, BASURISOLUTUEURI; INMEMEBERABLE & HTT; HTMLode & gt; SQ = NULL; Try {CV = Sharpclaim} SRPCulator. Load (Baseroom);} Catch (WebException we ) {Console.WriteLine (we.Message); release;} foreach (var node ("a [href]") in {{bc.Add (new priority download speed (1 New download item {Uri = New Uri (Baseouri, node properties ["href"]. Value)})}}}}}, CTS.Token;  

It's a little late It runs fine for (unless it does not descend on 404), it searches every link and downloads it.

404 occurs in intensity. As the load method I expect 'd Is: Public stable IEnumerable & lt; HtmlNode & gt; load (Uri uri) {var doc = new HtmlDocument (); Webclick wc = new webclient (); (Var str = wc. OpenRead (uri)) using doc.Load (str); Yield returns doc.DocumentNode; }

But then why is not blocking my efforts?

If I go up the call stack then this line indicates instead:

  foreach (sq.Find in var node ("a [href]") )  

but sq.find does not even touch any web interface what's happening?

These lines are synchronous, using

  (var str = wc.OpenRead (uri)) doc.Load (str);  

What are they not? Should there be no error when loading under the road?

That's because loads do not take until you actually read the data, which The effort occurs after the block.


Comments