This project has moved and is read-only. For the latest updates, please go here.

Unknown error caused by HtmlAgility pack

Topics: User Forum
Sep 21, 2014 at 11:54 PM
Hi I have this code on a Universal App (Windows 8.1 and Windows Phone 8.1) on the "Shared" part of the project
HtmlWeb htmlW;
            public async Task<Dictionary<string, string>> GetSchedule_HC(string day, string week)
                    string year = "21"; //get from settings
                    string semestre = "S1"; //get from settings
                    string ciclo = "1"; //get from settings
                    string course = "1408"; //get from settings
                    string url = "";
                    string cicleY = "1"; //get from settings

                    htmlW = new HtmlWeb();
                    HtmlDocument htmlDoc = await htmlW.LoadFromWebAsync(url);
                    HtmlNode selectNode;
                    Dictionary<string, string> rtnval = new Dictionary<string, string>();
                    foreach (HtmlNode node in htmlDoc.DocumentNode.Descendants())
                            if (node.Name == "select" && node.GetAttributeValue("id", "") == "ContentPlaceHolder1_ddlAnoLect")
                                    selectNode = node;

                                    foreach (HtmlNode optNode in selectNode.Descendants())
                                            rtnval.Add(optNode.Attributes["value"].Value, optNode.InnerText);
                    //IEnumerable<HtmlNode> selectElm = from selectNode in htmlDoc.DocumentNode.Descendants()
                    //                                                                where selectNode.Name == "select" && selectNode.GetAttributeValue("id", "") == "ContentPlaceHolder1_ddlAnoLect"
                    //                                                                select selectNode;

                    return rtnval;
And after some break points I've found out that after this code is executed
HtmlDocument htmlDoc = await htmlW.LoadFromWebAsync(url);
It throws an error not handled by the debugger... Just sents me to this line global::System.Diagnostics.Debugger.Break();

Any idea...