Type's GetInterface returns null

Using the following code under Unity 2017.3.0f3 with the Stable runtime it returns true for both HasInterfaceOld and HasInterfaceNew. However with the Experimental runtime it returns false for HasInterfaceOld and true for HasInterfaceNew: GetInterface can’t find the given interface name, however grabbing all with GetInterfaces and iterating through the array it can be found.

using System;
using System.Collections.Generic;
using UnityEngine;

public class TypeGetInterfaceTest : MonoBehaviour {
   
    void Start () {
        Type type = typeof(Dictionary<string, object>);
        string iface = "System.Collections.IDictionary";

        Debug.LogFormat("Type({0}) Has Interface '{1}'? Using GetInterface: '{2}', iterating through GetInferfaces: {3}",
            type.Name,
            iface,
            HasInterfaceOld(type, iface),
            HasInterfaceNew(type, iface));
    }

    bool HasInterfaceOld(Type type, string name)
    {
        return type.GetInterface(name, true) != null;
    }

    bool HasInterfaceNew(Type type, string name)
    {
        Type[] interfaces = type.GetInterfaces();

        foreach (var iface in interfaces)
        {
            if (iface.FullName.Equals(name, StringComparison.OrdinalIgnoreCase))
                return true;
        }

        return false;
    }
}

This looks like a bug. Can you submit a bug report via the Unity editor? Thanks!

@JoshPeterson

Submitted as case #985462.

2 Likes