microsoft / microsoft/WPF-Samples

HtmlFromXamlConverter.cs crashes when there is a FontSize attribute on the FlowDocument itself and asFullDocument=false

Open
#47 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
5.7k
Forks
3.3k
Avg merge
12d 8h
Merged PRs (30d)
2

Description

It throws me a System.IndexOutOfRangeException at line 493.

   bij System.Xml.XmlTextWriter.WriteEndStartTag(Boolean empty)
   bij System.Xml.XmlTextWriter.AutoComplete(Token token)
   bij System.Xml.XmlTextWriter.WriteStartElement(String prefix, String localName, String ns)
   bij System.Xml.XmlWriter.WriteStartElement(String localName)
   bij MarkupConverter.HtmlFromXamlConverter.WriteElement(XmlTextReader xamlReader, XmlTextWriter htmlWriter, StringBuilder inlineStyle) in C:\Users\Laïla\Downloads\Converting between RTF and HTML\C#\MarkupConverter\HtmlFromXamlConverter.cs:regel 530
   bij MarkupConverter.HtmlFromXamlConverter.WriteElementContent(XmlTextReader xamlReader, XmlTextWriter htmlWriter, StringBuilder inlineStyle) in C:\Users\Laïla\Downloads\Converting between RTF and HTML\C#\MarkupConverter\HtmlFromXamlConverter.cs:regel 379
   bij MarkupConverter.HtmlFromXamlConverter.WriteFlowDocument(XmlTextReader xamlReader, XmlTextWriter htmlWriter, Boolean asFullDocument) in C:\Users\Laïla\Downloads\Converting between RTF and HTML\C#\MarkupConverter\HtmlFromXamlConverter.cs:regel 120
   bij MarkupConverter.HtmlFromXamlConverter.ConvertXamlToHtml(String xamlString, Boolean asFullDocument) in C:\Users\Laïla\Downloads\Converting between RTF and HTML\C#\MarkupConverter\HtmlFromXamlConverter.cs:regel 67
   bij FormatBarForRichTextBox.MainWindow.Button_Click_6(Object sender, RoutedEventArgs e) in C:\Users\Laïla\Downloads\FormatBarForRichTextBox\FormatBarForRichTextBox\FormatBarForRichTextBox\MainWindow.xaml.cs:regel 277

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in HtmlFromXamlConverter.cs, focusing on WriteFlowDocument and the WriteElement location reported in the stack trace. Reproduce conversion with a FontSize attribute on the FlowDocument and asFullDocument=false; done means this input no longer throws IndexOutOfRangeException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.