From 990e0b731cf7087bb401a185012ebbe6a465ad17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 8 Jul 2026 15:48:39 +0200 Subject: [PATCH 1/2] Restore Polyfills.Polyfill.Deconstruct for binary compat (#9710) Older Microsoft.Testing extension assemblies (built before Polyfill adopted [Embedded]) reference Polyfills.Polyfill.Deconstruct in the core Microsoft.Testing.Platform assembly via InternalsVisibleTo. Dropping the Polyfill package removed that method, so pairing a newer core with an older extension (e.g. an old Telemetry) throws MissingMethodException at runtime. Re-add the single Deconstruct extension on the existing [Embedded] Polyfill partial type to restore the runtime binding without re-exposing the polyfill to source consumers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/Polyfills/Polyfill.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Polyfills/Polyfill.cs diff --git a/src/Polyfills/Polyfill.cs b/src/Polyfills/Polyfill.cs new file mode 100644 index 0000000000..dba043a0a0 --- /dev/null +++ b/src/Polyfills/Polyfill.cs @@ -0,0 +1,28 @@ +// + +#pragma warning disable + +// Binary-compatibility shim for the (now removed) Polyfill NuGet package. +// +// Older Microsoft.Testing extension assemblies (built before Polyfill switched to +// [Embedded] types) were compiled against `Polyfills.Polyfill.Deconstruct` and, through +// InternalsVisibleTo, bound that call to the copy declared in the core +// Microsoft.Testing.Platform assembly. When Polyfill was dropped, that method disappeared, +// so mixing a newer core with an older extension throws: +// System.MissingMethodException: Method not found: 'Void Polyfills.Polyfill.Deconstruct(...)'. +// Keeping this method on the [Embedded] Polyfill type (see ProcessExtensions.cs) restores the +// runtime binding without re-exposing the polyfill to source consumers. +// See https://github.com/microsoft/testfx/issues/9710. + +using System.Collections.Generic; + +namespace Polyfills; + +internal static partial class Polyfill +{ + public static void Deconstruct(this KeyValuePair target, out TKey key, out TValue value) + { + key = target.Key; + value = target.Value; + } +} From 6845c3df90e66d28280fb33b5d7cc07bb4d2c48c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 8 Jul 2026 16:14:32 +0200 Subject: [PATCH 2/2] Mark Deconstruct compat shim [Obsolete] for removal in next MTP major (#9710) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/Polyfills/Polyfill.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Polyfills/Polyfill.cs b/src/Polyfills/Polyfill.cs index dba043a0a0..d00af935d5 100644 --- a/src/Polyfills/Polyfill.cs +++ b/src/Polyfills/Polyfill.cs @@ -14,12 +14,14 @@ // runtime binding without re-exposing the polyfill to source consumers. // See https://github.com/microsoft/testfx/issues/9710. +using System; using System.Collections.Generic; namespace Polyfills; internal static partial class Polyfill { + [Obsolete("Binary-compatibility shim for pre-[Embedded] Polyfill extension assemblies (see https://github.com/microsoft/testfx/issues/9710). It has no source callers and MUST be removed in the next major version of Microsoft.Testing.Platform.")] public static void Deconstruct(this KeyValuePair target, out TKey key, out TValue value) { key = target.Key;