Completed
Last Updated: 14 May 2024 15:37 by ADMIN
Release 2024.2.514 (2024 Q2)
Martin Ivanov
Created on: 06 Mar 2024 13:33
Category: RichTextBox
Type: Bug Report
0
RichTextBox: NullReferenceException in the HtmlFormatProvider import when "var" CSS function is used in the HTML

NullReferenceException is thrown when the "var" CSS function is used in the HTML on HtmlFormatProvider Import method call. 

The exception occurs only for CSS properties processed by RadRichTextBox. For example: "vertical-align", "font-family", "font-weight", "text-decoration-underline", etc.

The following HTML produces such error:

<span style="vertical-align: var(--my-variable);">

</span>

If the span tag doesn't have any content, the error doesn't occur.

The exception stacktrace is:

at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.FillSpanProperties(SpanProperties spanProps, EvaluateProperty evalFunction, IEnumerable`1 disregarderdDefaultStyleBagPropertiesCollection)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.CreateSpanFromTextNode(INode childNode, Paragraph paragraph, IEnumerable`1 disregarderdDefaultStyleBagPropertiesCollection)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessContentNode(INode node)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.<>c__DisplayClass80_0.<ProcessNode>b__0()
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessNode(INode node)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessGenericNode(INode node)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.<>c__DisplayClass80_0.<ProcessNode>b__0()
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessNode(INode node)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessGenericNode(INode node)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.<>c__DisplayClass80_0.<ProcessNode>b__0()
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessNode(INode node)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessGenericNode(INode node)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.<>c__DisplayClass80_0.<ProcessNode>b__0()
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessHyperlinkNode(INode node, Action innerAction)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessAnnotationsForNode(INode node, Action innerAction)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessNode(INode node)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessGenericNode(INode node)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.<>c__DisplayClass80_0.<ProcessNode>b__0()
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.ProcessNode(INode node)
   at Telerik.Windows.Documents.FormatProviders.Html.Import.HtmlDocumentImporter.Import(Stream input)

To work this around, avoid  using the "var" function in the CSS.

0 comments