I'm working with WebHTMLEditor to allow business users to create content for a site, and some business users would like to copy and paste from Word directly into the editor.
This works well enough until the user clicks the save button. If I debug the error I get the following exception:
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
It seems to occur when quite a lot of XHTML has to be parsed. I've tried cleaning up the XHTML by removing all attributes and leaving just the nodes and the text, but the error still occurs. I've also made sure the XHTML is well-formed. There is some part of the XHTML that contains several nested nodes, and seems to cause the error when saving.
I tried trimming the XHTML to isolate the node that caused the error. If it's by itself, it doesn't cause an error, but it I include enough sibling nodes then it crashes.
Is there some limit to the depth of number of nodes allowed in the XHTML?
The call stack is as follows.
> mscorlib.dll!System.DateTimeFormat.FormatCustomized(System.DateTime dateTime, string format, System.Globalization.DateTimeFormatInfo dtfi) + 0x879 bytes mscorlib.dll!System.DateTimeFormat.Format(System.DateTime dateTime, string format, System.Globalization.DateTimeFormatInfo dtfi) + 0xf1 bytes mscorlib.dll!System.DateTime.ToString(string format, System.IFormatProvider provider) + 0x1c bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.log.logMsg(Infragistics.WebUI.WebHtmlEditor.log.logType type, string message) + 0x3f bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0xe5 bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x3d2 bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x3d2 bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x31e bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x31e ......... infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x31e bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x31e bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x31e bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x31e bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x31e bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x3d2 bytes infragistics.webui.webhtmleditor.v7.1.dll!Infragistics.WebUI.WebHtmlEditor.HtmlReader.ProcessData(System.Xml.XmlNode parent) + 0x65a bytes
What Tony said.
BTW, Tony I have not had these issues since I stopped using the TEXTXHTML property. Now we set the Text Property on the way in and read it on the way out. And yes, we strip anything pasted in from Word. I suggest everyone do the same as the markup from Word is a mess.
The problem turned out to be a combination of issues. The data in the app was being set using the .Text property, but retrieved as the .TextXHTML property. The .TextXHTML property does a conversion on the text to make it conform to XHTML standards, but the original input wasn't XHTML compliant. In this case there was a unique combination of nested unclosed <p> tags, whose meaning couldn't be interpreted by a parser. Covert this back and forth a couple hundred times, and you end up with something that isn't XHTML compliant, and a string with so many levels of nesting (becaue of the unclosed p tags), that the parser can't even recurse through it.
As long as your input is valid XHTML, you shoudn't be concerned. If your input isn't valid XHTML, then you should be aware that converting from HTML to XHTML, isn't something that will work 100% of the time without intervention.
Hope this helps,
-Tony
We are considering adding this control to some of our projects. After reading this post there is little chance we could go forward without first having this issue resolved. Could someone please provide what the current status is or if this has been resolved. Being able to copy/paste from Word is functionally important as well as being able to input and output xhtml without crashing the application. Thanks.
I've had a similar problem and I did open a ticket for it. Of course, the first time through support, they don't think it through and I have to explain even further.
What happens in my case when users get all paste happy from Word or Excel even, when I go to read the texthtml? property, it crashes the worker process. Get five people to do that in five minutes and it shuts down the site thanks to the application pool settings. Tony, I don't know if you could breathe some life into my ticket or not. WHE806.
It's hard to say for sure what's going on, without reproing the behavior. If you have a string that will repeatedly cause this crash when pasted into the HTMLEditor, I'd recommend sending that to the Infragistics Developer Support team (www.infragistics.com/gethelp) I'd tell you to paste it here, but I have a feeling many of the characters will get convereted to HTML literals, etc.
i'd guess one of 2 things is happening here - either the code is reaching a maximum recursion depth and it's not a problem with the input, or the input is in someway causing an infinite loop. Either way, I think we should have a look and see how we can avoid this scenario in the editor.