Inlined method with generic ref parameters cause problems

IDE: VS 2015
Version: 8.3.91.1965
Target (If relevant): .NET/Android/iOS
Description:

    public class TestClass {

    public static void doTest() {

        // bug 1) compile error
        int c = 5;
        int d = 6;
        /**
        Android compile error: 
        Uncaught translation error: com.android.dx.cf.code.SimException: expected type java.lang.Object but found int 1 error; aborting

        iOS compiling just crash the VS 2015.
        */
        swap(ref c, ref d);

        // bug 2) won't work for array
        string[] arr = new string[]{"c","d"};
        swap(ref arr[0], ref arr[1]);
        assert(arr[0] == "d");  // failed on .NET/Android/iOS
    }

    public static __inline void swap<T>(ref T a, ref T b) {
        var t = a;
        a = b;
        b = t;
    }
}

By the way, I use __inline to optmize the swap function because I guess it’s the only way to generate efficient codes for Java and iOS. If it’s not inlined, the generated Java code will include inefficient lines to construct VarParameter objects to bypass Java limitations. And I’m not sure how the compiler handle generic ref parameter for iOS if raw types are involved.
I think a built-in cross-platform swap function for Elements is needed, because it’s too tricky to build a homemade one. This function should provide the most efficient way to swap two values.

Thanks, logged as bugs://74897

bugs://74897 got closed with status fixed.

Logged as bugs://i62932.

bugs://i62932 was closed as fixed.