Fix binary compatibility issue with MoveCssInline method signatures
This PR fixes a binary compatibility issue where applications compiled against older versions of PreMailer.Net would fail at runtime with "Method not found" errors when calling MoveCssInline methods.
Problem
The issue occurred because the useEmailFormatter parameter was added to all MoveCssInline method overloads, changing their signatures from:
// Old signature (7/8 parameters)
MoveCssInline(bool, string, string, bool, bool, IMarkupFormatter, bool)
to:
// New signature (8/9 parameters)
MoveCssInline(bool, string, string, bool, bool, IMarkupFormatter, bool, bool)
When applications compiled against the old signatures tried to call these methods, the runtime couldn't find the exact method signatures they expected, resulting in MethodNotFoundException.
Solution
Added backward-compatible method overloads that match the old signatures exactly:
-
Static method overloads for all 4 variants:
-
MoveCssInline(string html, ...7 params) -
MoveCssInline(Stream stream, ...7 params) -
MoveCssInline(Uri baseUri, string html, ...8 params) -
MoveCssInline(Uri baseUri, Stream stream, ...8 params)
-
-
Instance method overload:
-
MoveCssInline(...7 params)
-
All backward-compatible overloads delegate to the corresponding new methods with useEmailFormatter = false, preserving the original behavior.
Testing
- Added comprehensive unit tests covering all backward-compatible method signatures
- Verified with a standalone console application that both old and new signatures work correctly
- All existing tests continue to pass (178/178)
- No breaking changes for existing code
This ensures applications compiled against any version of PreMailer.Net will continue to work without recompilation.
Fixes #434.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.