KeyNotFoundException when searching for "apos"

Topics: User Forum
May 24, 2013 at 6:29 PM
I hit the following exception:
System.Collections.Generic.KeyNotFoundException was unhandled by user code
  HResult=-2146232969
  Message=The given key was not present in the dictionary.
  Source=mscorlib
  StackTrace:
       at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       at HtmlAgilityPack.HtmlEntity.DeEntitize(String text) in D:\Source\htmlagilitypack.new\Trunk\HtmlAgilityPack\HtmlEntity.cs:line 646
       at HtmlAgilityPack.HtmlToText.ConvertTo(HtmlNode node, TextWriter outText) in HtmlConvert.cs:line 62
       at HtmlAgilityPack.HtmlToText.ConvertContentTo(HtmlNode node, TextWriter outText) in \HtmlConvert.cs:line 31
       at HtmlAgilityPack.HtmlToText.ConvertTo(HtmlNode node, TextWriter outText) in HtmlConvert.cs:line 75
       at HtmlAgilityPack.HtmlToText.ConvertContentTo(HtmlNode node, TextWriter outText) in HtmlConvert.cs:line 31
       at HtmlAgilityPack.HtmlToText.ConvertTo(HtmlNode node, TextWriter outText) in HtmlConvert.cs:line 43
       at HtmlAgilityPack.HtmlToText.ConvertHtml(String html) in HtmlConvert.cs:line 24
       ...
The key that it was trying to look up is "apos".

Here is the markup originally generated generated by an HtmlRichTextBox that my application was trying to convert:
"<font face=\"Microsoft Sans Serif\" color=\"#000000\" size=\"2\"><p align=\"left\">&apos;</font>"