Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Delegate Equals() method #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mattwarren
Copy link

@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