Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify a #text node name causes a StackOverflowException #548

Closed
BrianPainter88 opened this issue Apr 25, 2024 · 2 comments
Closed

Modify a #text node name causes a StackOverflowException #548

BrianPainter88 opened this issue Apr 25, 2024 · 2 comments
Assignees

Comments

@BrianPainter88
Copy link

Here is what to include in your request to make sure we implement a solution as quickly as possible.

1. Description

My application is using a process in which it loops through certain nodes and removes any namespaces that may be appended to the name. After the upgrade to version 1.11.48, a StackOverflowException is encountered when updating the HtmlNode.Name property and attempting to access either the HtmlNode.InnerHtml or HtmlNode.InnerText properties.

2. Exception

Exception of type 'System.StackOverflowException' was thrown.

3. Fiddle or Project

https://dotnetfiddle.net/Q1LM01

using System;
using HtmlAgilityPack;

public class Program
{
	public static void Main()
	{
		var document = new HtmlDocument();
		document.LoadHtml("a");

		foreach (var node in document.DocumentNode.ChildNodes)
		{
			if (node.Name == "#text")
			{
				node.Name = node.Name;
			}
		}
		
		foreach (var node in document.DocumentNode.ChildNodes)
		{
			Console.WriteLine(node.InnerHtml);
		}
	}
}

4. Any further technical details

Add any relevant detail can help us, such as:

  • HAP version: started in 1.11.48
  • NET version: any
@JonathanMagnan JonathanMagnan self-assigned this Apr 27, 2024
@JonathanMagnan
Copy link
Member

Hello @BrianPainter88 ,

Thank you for reporting, the issue has been fixed for HtmlTextNode.

A new version should be released early this week.

Best Regards,

Jon

@JonathanMagnan
Copy link
Member

Hello @BrianPainter88 ,

A new version has been released today.

Could you let me know if everything is now working with the latest version?

Best Regards,

Jon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants