Skip to content

Commit

Permalink
[tests] Fix SetHandleTest to handle 'callvirt'. (#21726)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rolfbjarne authored Dec 2, 2024
1 parent 12b16e5 commit c2a90c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/cecil-tests/SetHandleTest.KnownFailures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
2 changes: 1 addition & 1 deletion tests/cecil-tests/SetHandleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static bool VerifyMethod (MethodDefinition method, IList<Instruction> 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;
Expand Down

6 comments on commit c2a90c3

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.