Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: Unknown error caused by HtmlAgility pack

$
0
0
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 = "https://academicos.ubi.pt/online/horarios.aspx?p=a";
                    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...

Viewing all articles
Browse latest Browse all 655

Trending Articles