Completed
Last Updated: 29 Sep 2020 12:08 by ADMIN
Release LIB 2020.3.1005 (05/10/2020)
Victor
Created on: 12 Sep 2020 10:01
Category: RichTextBox
Type: Bug Report
0
Telerik.Windows.Documents.FormatProviders.Html.HtmlFormatProvider crashes with Null Reference trying import html with empty font-size attribute

Here we are:

            HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
            htmlProvider.ExportSettings.StylesExportMode = StylesExportMode.Inline;

            string _html =
                @"
                <html>
                <head>
                <meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"">
                </head>
                <body>
                <div name=""divtagdefaultwrapper"" style=""font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0"">

                <div class=""WordSection1"">
                <p class=""MsoNormal"" style=""text-autospace:none"">
                <span style=""font-size:11pt; color:rgb(31,73,125)"">
                            I am out of office, please contact Aaaaaa Bbbbbbb (Tel: &#43;1-234-567-8900/email:
                <a href=""mailto:aaaaaa.bbbbbb@zzz.com"">aaaaaa.bbbbbb@zzz.com</a>) for assistance
                </span>
                </p>
                </div>
                </div>

                </body>
                </html>
                ";

            RadDocument _doc = htmlProvider.Import(_html); 
            radRichTextBox.Document = _doc;

And here is an exception:

 

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Telerik.Windows.Controls.RichTextBox
  StackTrace:
   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__DisplayClass79_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__DisplayClass79_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__DisplayClass79_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)
   at Telerik.Windows.Documents.FormatProviders.Html.HtmlFormatProvider.Import(Stream input)
   at Telerik.Windows.Documents.FormatProviders.Html.HtmlFormatProvider.Import(String input)
   at WpfTest.MainWindow.ButtonTest_OnClick(Object sender, RoutedEventArgs e) in C:\Users\mosvk\Source\Workspaces\Bm.Extensions\test\WpfTest\MainWindow.xaml.cs:line 191

 

       
1 comment
ADMIN
Dimitar
Posted on: 15 Sep 2020 08:02

Hello Victor,

I was able to reproduce the issue on my side. I have approved it and I have updated your Telerik points. 

Unfortunately, I can not suggest a workaround for the issue. 

Thank you for your understanding.

Regards,
Dimitar
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).