Skip to content

Fix Delegate Equals() method#9

Open
mattwarren wants to merge 1 commit into
SteveSanderson:masterfrom
mattwarren:patch-1
Open

Fix Delegate Equals() method#9
mattwarren wants to merge 1 commit into
SteveSanderson:masterfrom
mattwarren:patch-1

Conversation

@mattwarren
Copy link
Copy Markdown

@mattwarren mattwarren commented Aug 30, 2017

Simple fix for the underlying issue of the bug described here:

// because the DotNetAnywhere runtime crashes if you try to put a delegate instance
// as a key into a Dictionary and then check whether dict.ContainsKey(thatDelegate).

Tested with code like this:

Action actionA = new Action(TestMethod);
Action actionB = new Action(SomeOtherMethod);
Action actionC = new Action(TestMethod); // same Target as actionA

// Before the fix calling 'Equals() give the error "Opcode not available: 0x0000006c"
Console.WriteLine("actionA.Equals(actionB) = {0}", actionA.Equals(actionB)); // False
Console.WriteLine("actionA.Equals(actionC) = {0}", actionA.Equals(actionC)); // True

To properly allow DNA to handle boxing/unboxing of IntPtr, support would have to be added for:

  • JIT_BOX_PTR (probably here)
  • UNBOX CIL op-code (CIL_UNBOX_ANY is already supported)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant