From c2a90c3ba441b8148fa221c2621b8fe48cfb24a2 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 2 Dec 2024 10:08:33 -0800 Subject: [PATCH] [tests] Fix SetHandleTest to handle 'callvirt'. (#21726) NSObject.Handle is virtual (because it's an implementation of INativeObject.Handle), so it can be called with 'callvirt' - which means we can't filter to only 'call' instructions, we need to look for 'callvirt' instructions as well. --- tests/cecil-tests/SetHandleTest.KnownFailures.cs | 1 + tests/cecil-tests/SetHandleTest.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/cecil-tests/SetHandleTest.KnownFailures.cs b/tests/cecil-tests/SetHandleTest.KnownFailures.cs index 39fa28b6379..d030c159b86 100644 --- a/tests/cecil-tests/SetHandleTest.KnownFailures.cs +++ b/tests/cecil-tests/SetHandleTest.KnownFailures.cs @@ -39,6 +39,7 @@ public partial class SetHandleTest { "ModelIO.MDLNoiseTexture::.ctor(System.Single,System.String,CoreGraphics.NVector2i,ModelIO.MDLTextureChannelEncoding,ModelIO.MDLNoiseTextureType)", "MultipeerConnectivity.MCSession::.ctor(MultipeerConnectivity.MCPeerID,Security.SecIdentity,MultipeerConnectivity.MCEncryptionPreference)", "MultipeerConnectivity.MCSession::.ctor(MultipeerConnectivity.MCPeerID,Security.SecIdentity,Security.SecCertificate[],MultipeerConnectivity.MCEncryptionPreference)", + "ObjCRuntime.Runtime::RegisterNSObject(Foundation.NSObject,System.IntPtr)", "ScreenCaptureKit.SCContentFilter::.ctor(ScreenCaptureKit.SCDisplay,ScreenCaptureKit.SCRunningApplication[],ScreenCaptureKit.SCWindow[],ScreenCaptureKit.SCContentFilterOption)", "ScreenCaptureKit.SCContentFilter::.ctor(ScreenCaptureKit.SCDisplay,ScreenCaptureKit.SCWindow[],ScreenCaptureKit.SCContentFilterOption)", "Security.SecTrust2::.ctor(Security.SecTrust)", diff --git a/tests/cecil-tests/SetHandleTest.cs b/tests/cecil-tests/SetHandleTest.cs index fd269c52193..072c0a31256 100644 --- a/tests/cecil-tests/SetHandleTest.cs +++ b/tests/cecil-tests/SetHandleTest.cs @@ -25,7 +25,7 @@ static bool VerifyMethod (MethodDefinition method, IList instructio reason = null; foreach (var instr in instructions) { - if (instr.OpCode != OpCodes.Call) + if (instr.OpCode != OpCodes.Call && instr.OpCode != OpCodes.Callvirt) continue; var target = instr.Operand as MethodReference;