HTML Agility Pack Causes Code to Stop Executing After Load Call

Multi tool use
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am creating a small application to parse HTML of a page into variables so I can generate code for another proprietary application. I am using VB with HTMLAgilityPack for parsing. When I execute the load statement, no error are shown but all other code after that line simply fails to execute, as if it isn't even there.
Private Sub Importer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim strImportType As String
Dim strImportURL As String
strImportType = main.importType
strImportURL = main.importURL
Dim web As New HtmlAgilityPack.HtmlWeb
Dim content As New HtmlAgilityPack.HtmlDocument
content = web.Load(strImportURL)
vb.net visual-studio xpath html-agility-pack
|
show 1 more comment
I am creating a small application to parse HTML of a page into variables so I can generate code for another proprietary application. I am using VB with HTMLAgilityPack for parsing. When I execute the load statement, no error are shown but all other code after that line simply fails to execute, as if it isn't even there.
Private Sub Importer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim strImportType As String
Dim strImportURL As String
strImportType = main.importType
strImportURL = main.importURL
Dim web As New HtmlAgilityPack.HtmlWeb
Dim content As New HtmlAgilityPack.HtmlDocument
content = web.Load(strImportURL)
vb.net visual-studio xpath html-agility-pack
Check the Immediate Window (CTRL + ALT + I
). It logs all exceptions that are thrown, handled or not. Exceptions occurring in theLoad
event doesn't always break the application, so it's easy to miss.
– Visual Vincent
Jan 3 at 22:49
@VisualVincent I see what you mean. I wouldn't have noticed that. Exception thrown: 'HtmlAgilityPack.HtmlWebException' in HtmlAgilityPack.dll I will note that strImportURL points to a local file. I have tried it with the raw path as well as the web browser generated file:// before the local path.
– Gage
Jan 3 at 23:00
You can use the Exception Settings window to force VS to break on all exceptions. That should properly display the error for you (just remember to reset the changes in the window again when you are done).
– Visual Vincent
Jan 3 at 23:08
@user3661293 This is easier: HTML Parser for local HTML files.
– Andrew Morton
Jan 4 at 9:39
1
@AndrewMorton When actually running the comp[leted program it will be run against a live webpage. I was just using a local file for testing.
– Gage
Jan 4 at 14:02
|
show 1 more comment
I am creating a small application to parse HTML of a page into variables so I can generate code for another proprietary application. I am using VB with HTMLAgilityPack for parsing. When I execute the load statement, no error are shown but all other code after that line simply fails to execute, as if it isn't even there.
Private Sub Importer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim strImportType As String
Dim strImportURL As String
strImportType = main.importType
strImportURL = main.importURL
Dim web As New HtmlAgilityPack.HtmlWeb
Dim content As New HtmlAgilityPack.HtmlDocument
content = web.Load(strImportURL)
vb.net visual-studio xpath html-agility-pack
I am creating a small application to parse HTML of a page into variables so I can generate code for another proprietary application. I am using VB with HTMLAgilityPack for parsing. When I execute the load statement, no error are shown but all other code after that line simply fails to execute, as if it isn't even there.
Private Sub Importer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim strImportType As String
Dim strImportURL As String
strImportType = main.importType
strImportURL = main.importURL
Dim web As New HtmlAgilityPack.HtmlWeb
Dim content As New HtmlAgilityPack.HtmlDocument
content = web.Load(strImportURL)
vb.net visual-studio xpath html-agility-pack
vb.net visual-studio xpath html-agility-pack
edited Jan 4 at 6:41
J Sushil
8521021
8521021
asked Jan 3 at 21:33
GageGage
14
14
Check the Immediate Window (CTRL + ALT + I
). It logs all exceptions that are thrown, handled or not. Exceptions occurring in theLoad
event doesn't always break the application, so it's easy to miss.
– Visual Vincent
Jan 3 at 22:49
@VisualVincent I see what you mean. I wouldn't have noticed that. Exception thrown: 'HtmlAgilityPack.HtmlWebException' in HtmlAgilityPack.dll I will note that strImportURL points to a local file. I have tried it with the raw path as well as the web browser generated file:// before the local path.
– Gage
Jan 3 at 23:00
You can use the Exception Settings window to force VS to break on all exceptions. That should properly display the error for you (just remember to reset the changes in the window again when you are done).
– Visual Vincent
Jan 3 at 23:08
@user3661293 This is easier: HTML Parser for local HTML files.
– Andrew Morton
Jan 4 at 9:39
1
@AndrewMorton When actually running the comp[leted program it will be run against a live webpage. I was just using a local file for testing.
– Gage
Jan 4 at 14:02
|
show 1 more comment
Check the Immediate Window (CTRL + ALT + I
). It logs all exceptions that are thrown, handled or not. Exceptions occurring in theLoad
event doesn't always break the application, so it's easy to miss.
– Visual Vincent
Jan 3 at 22:49
@VisualVincent I see what you mean. I wouldn't have noticed that. Exception thrown: 'HtmlAgilityPack.HtmlWebException' in HtmlAgilityPack.dll I will note that strImportURL points to a local file. I have tried it with the raw path as well as the web browser generated file:// before the local path.
– Gage
Jan 3 at 23:00
You can use the Exception Settings window to force VS to break on all exceptions. That should properly display the error for you (just remember to reset the changes in the window again when you are done).
– Visual Vincent
Jan 3 at 23:08
@user3661293 This is easier: HTML Parser for local HTML files.
– Andrew Morton
Jan 4 at 9:39
1
@AndrewMorton When actually running the comp[leted program it will be run against a live webpage. I was just using a local file for testing.
– Gage
Jan 4 at 14:02
Check the Immediate Window (
CTRL + ALT + I
). It logs all exceptions that are thrown, handled or not. Exceptions occurring in the Load
event doesn't always break the application, so it's easy to miss.– Visual Vincent
Jan 3 at 22:49
Check the Immediate Window (
CTRL + ALT + I
). It logs all exceptions that are thrown, handled or not. Exceptions occurring in the Load
event doesn't always break the application, so it's easy to miss.– Visual Vincent
Jan 3 at 22:49
@VisualVincent I see what you mean. I wouldn't have noticed that. Exception thrown: 'HtmlAgilityPack.HtmlWebException' in HtmlAgilityPack.dll I will note that strImportURL points to a local file. I have tried it with the raw path as well as the web browser generated file:// before the local path.
– Gage
Jan 3 at 23:00
@VisualVincent I see what you mean. I wouldn't have noticed that. Exception thrown: 'HtmlAgilityPack.HtmlWebException' in HtmlAgilityPack.dll I will note that strImportURL points to a local file. I have tried it with the raw path as well as the web browser generated file:// before the local path.
– Gage
Jan 3 at 23:00
You can use the Exception Settings window to force VS to break on all exceptions. That should properly display the error for you (just remember to reset the changes in the window again when you are done).
– Visual Vincent
Jan 3 at 23:08
You can use the Exception Settings window to force VS to break on all exceptions. That should properly display the error for you (just remember to reset the changes in the window again when you are done).
– Visual Vincent
Jan 3 at 23:08
@user3661293 This is easier: HTML Parser for local HTML files.
– Andrew Morton
Jan 4 at 9:39
@user3661293 This is easier: HTML Parser for local HTML files.
– Andrew Morton
Jan 4 at 9:39
1
1
@AndrewMorton When actually running the comp[leted program it will be run against a live webpage. I was just using a local file for testing.
– Gage
Jan 4 at 14:02
@AndrewMorton When actually running the comp[leted program it will be run against a live webpage. I was just using a local file for testing.
– Gage
Jan 4 at 14:02
|
show 1 more comment
1 Answer
1
active
oldest
votes
After using Visual Vincent suggestion to open the Exceptions Settings and force VB to fail it allowed for more information. This issue was simply that the file was not being found due to spaces in the filename. Adding quotes around the filename resolved the issue.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030097%2fhtml-agility-pack-causes-code-to-stop-executing-after-load-call%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
After using Visual Vincent suggestion to open the Exceptions Settings and force VB to fail it allowed for more information. This issue was simply that the file was not being found due to spaces in the filename. Adding quotes around the filename resolved the issue.
add a comment |
After using Visual Vincent suggestion to open the Exceptions Settings and force VB to fail it allowed for more information. This issue was simply that the file was not being found due to spaces in the filename. Adding quotes around the filename resolved the issue.
add a comment |
After using Visual Vincent suggestion to open the Exceptions Settings and force VB to fail it allowed for more information. This issue was simply that the file was not being found due to spaces in the filename. Adding quotes around the filename resolved the issue.
After using Visual Vincent suggestion to open the Exceptions Settings and force VB to fail it allowed for more information. This issue was simply that the file was not being found due to spaces in the filename. Adding quotes around the filename resolved the issue.
answered Jan 8 at 16:09
GageGage
14
14
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54030097%2fhtml-agility-pack-causes-code-to-stop-executing-after-load-call%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
InYCD6o,y m
Check the Immediate Window (
CTRL + ALT + I
). It logs all exceptions that are thrown, handled or not. Exceptions occurring in theLoad
event doesn't always break the application, so it's easy to miss.– Visual Vincent
Jan 3 at 22:49
@VisualVincent I see what you mean. I wouldn't have noticed that. Exception thrown: 'HtmlAgilityPack.HtmlWebException' in HtmlAgilityPack.dll I will note that strImportURL points to a local file. I have tried it with the raw path as well as the web browser generated file:// before the local path.
– Gage
Jan 3 at 23:00
You can use the Exception Settings window to force VS to break on all exceptions. That should properly display the error for you (just remember to reset the changes in the window again when you are done).
– Visual Vincent
Jan 3 at 23:08
@user3661293 This is easier: HTML Parser for local HTML files.
– Andrew Morton
Jan 4 at 9:39
1
@AndrewMorton When actually running the comp[leted program it will be run against a live webpage. I was just using a local file for testing.
– Gage
Jan 4 at 14:02