Search code examples
c#asp.netmethodnotfoundanglesharppremailer

PreMailer "Method Not Found" (AngleSharp.Dom.IElement.RemoveAttribute)


I have this code which inlines CSS using PreMailer;

PreMailer.Net.PreMailer cleanser = new PreMailer.Net.PreMailer(htmlString);
PreMailer.Net.InlineResult result = cleanser.MoveCssInline(ignoreElements: ".ignore");
return result.Html

But I'm getting this exception:

Method not found: 'Void AngleSharp.Dom.IElement.RemoveAttribute(System.String)'

Stack Trace

[MissingMethodException: Method not found: 'Void AngleSharp.Dom.IElement.RemoveAttribute(System.String)'.]
PreMailer.Net.StyleClassApplier.ApplyStyles(IElement domElement, StyleClass clazz) +0
PreMailer.Net.StyleClassApplier.ApplyAllStyles(Dictionary`2 elementDictionary) +125
PreMailer.Net.PreMailer.MoveCssInline(Boolean removeStyleElements, String ignoreElements, String css, Boolean stripIdAndClassAttributes, Boolean removeComments) +241

The answer is probably really obvious but I'm just not clicking on.

AngleSharp: v0.9.9

PreMailer: v1.5.4


Solution

  • There has been an update released for PreMailer. Upgrade to 1.5.5 to resolve this issue! No rollback for AngleSharp required!