Skip to content

Conversation

Copy link

Copilot AI commented Jul 31, 2025

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.

Copilot AI changed the title [WIP] Method not found: 'PreMailer.Net.InlineResult PreMailer.Net.PreMailer.MoveCssInline(Boolean, System.String, System.String, Boolean, Boolean, AngleSharp.IMarkupFormatter, Boolean)' Fix binary compatibility issue with MoveCssInline method signatures Jul 31, 2025
Copilot AI requested a review from martinnormark July 31, 2025 10:07
Copilot finished work on behalf of martinnormark July 31, 2025 10:07
Copilot AI and others added 2 commits August 25, 2025 08:32
…ary compatibility issue

Co-authored-by: martinnormark <67565+martinnormark@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants