Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

JumpStubNode doesn't preserve method identity #1083

Closed

Description

@MichalStrehovsky

The following program will print true on CoreRT even though it should print false.

using System;
using System.Runtime.InteropServices;

static class Interop1
{
    [DllImport("kernel32", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true)]
    public static unsafe extern int MessageBoxW(IntPtr hWnd, IntPtr lpText, IntPtr lpCaption, int type);
}

static class Interop2
{
    [DllImport("kernel32", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true)]
    public static unsafe extern int MessageBoxW(IntPtr hWnd, IntPtr lpText, IntPtr lpCaption, int type);
}

internal class Program
{
    private static void Main(string[] args)
    {
        Func<IntPtr, IntPtr, IntPtr, int, int> mb1 = Interop1.MessageBoxW;
        Func<IntPtr, IntPtr, IntPtr, int, int> mb2 = Interop2.MessageBoxW;
        Console.WriteLine(mb1 == mb2);
    }
}

The underlying issue is that the JumpStubNode causes both MethodEntrypoints to collapse into a single Node when in fact we need to preserve the information about the logical method associated with the extern symbol.

As part of fixing this, we should probably make JumpStubNode implement IMethodNode.

Activity

  1. added this to the milestone on Apr 4, 2016
  2. added a commit that references this issue on Apr 5, 2016
    79ebada
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions