Repository: dotnet/runtime
File: src/libraries/Common/tests/System/FunctionPointerTests.cs (C#)

Code before:
            Assert.False(fnPtrPrivateParam.IsVisible);
        }

        [Fact]
        public static unsafe void FunctionPointerContainsGenericParameters()
        {
            Type t = typeof(FunctionPointerHolder).Project();

            // A function pointer with non-generic return type should not contain generic parameters
            Type fnPtrNonGeneric = t.GetField(nameof(FunctionPointerHolder.Field_Int), Bindings)!.FieldType;
            Assert.True(fnPtrNonGeneric.IsFunctionPointer);
            Assert.False(fnPtrNonGeneric.ContainsGenericParameters);

            // A function pointer with generic return type should contain generic parameters
            MethodInfo m1 = t.GetMethod(nameof(FunctionPointerHolder.GenericReturnValue), Bindings)!;
            Type fnPtrGenericReturn = m1.ReturnType;
            Assert.True(fnPtrGenericReturn.IsFunctionPointer);
            Assert.True(fnPtrGenericReturn.ContainsGenericParameters);

            // A function pointer with generic parameter type should contain generic parameters
            MethodInfo m2 = t.GetMethod(nameof(FunctionPointerHolder.GenericArgument), Bindings)!;
            Type fnPtrGenericParam = m2.GetParameters()[1].ParameterType;
            Assert.True(fnPtrGenericParam.IsFunctionPointer);
            Assert.True(fnPtrGenericParam.ContainsGenericParameters);
        }

        [Theory]
        [InlineData(nameof(FunctionPointerHolder.MethodReturnValue1),
            "MethodReturnValue1()",
            "Int32",
            "System.Int32()")]
        [InlineData(nameof(FunctionPointerHolder.SeveralArguments),
            "SeveralArguments()",
            "Double",
            "System.Double(System.String, System.Boolean*&, System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyClass, System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyStruct&)",
            "String", "Boolean*&", "MyClass", "MyStruct&")]
        public static unsafe void MethodInfo(
            string methodName,
            string methodToStringPostfix,
            string expectedFcnPtrReturnName,
            string expectedFcnPtrFullName,
            params string[] expectedArgNames)
        {
            Type t = typeof(FunctionPointerHolder).Project();
            MethodInfo m = t.GetMethod(methodName, Bindings);
            Assert.Equal(expectedFcnPtrFullName + " " + methodToStringPostfix, m.ToString());

            Type fnPtrType = m.ReturnParameter.GetModifiedParameterType();
            Assert.Null(fnPtrType.FullName);
            Assert.Null(fnPtrType.AssemblyQualifiedName);
            Assert.Equal("", fnPtrType.Name);

Review comment (suggestion):
```suggestion
```
This is not exercising the fixed code

Code after:
            Assert.False(fnPtrPrivateParam.IsVisible);
        }

        [Theory]
        [InlineData(nameof(FunctionPointerHolder.MethodReturnValue1),
            "MethodReturnValue1()",
            "Int32",
            "System.Int32()")]
        [InlineData(nameof(FunctionPointerHolder.SeveralArguments),
            "SeveralArguments()",
            "Double",
            "System.Double(System.String, System.Boolean*&, System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyClass, System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyStruct&)",
            "String", "Boolean*&", "MyClass", "MyStruct&")]
        public static unsafe void MethodInfo(
            string methodName,
            string methodToStringPostfix,
            string expectedFcnPtrReturnName,
            string expectedFcnPtrFullName,
            params string[] expectedArgNames)
        {
            Type t = typeof(FunctionPointerHolder).Project();
            MethodInfo m = t.GetMethod(methodName, Bindings);
            Assert.Equal(expectedFcnPtrFullName + " " + methodToStringPostfix, m.ToString());

            Type fnPtrType = m.ReturnParameter.GetModifiedParameterType();
            Assert.Null(fnPtrType.FullName);
            Assert.Null(fnPtrType.AssemblyQualifiedName);
            Assert.Equal("", fnPtrType.Name);

            Assert.Equal(fnPtrType.GetFunctionPointerReturnType().Name, expectedFcnPtrReturnName);

            for (int i = 0; i < expectedArgNames.Length; i++)
            {
                Assert.Equal(fnPtrType.GetFunctionPointerParameterTypes()[i].Name, expectedArgNames[i]);
            }
        }

        [Theory]
        [InlineData(nameof(FunctionPointerHolder.Prop_Int), "System.Int32()")]
        [InlineData(nameof(FunctionPointerHolder.Prop_MyClass), "System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyClass()")]
        public static unsafe void Property(string name, string expectedToString)
        {
            Type t = typeof(FunctionPointerHolder).Project();
            PropertyInfo p = t.GetProperty(name, Bindings);
            Assert.Equal(expectedToString + " " + name, p.ToString());

            Type fnPtrType = p.PropertyType;
            Assert.Equal(expectedToString, fnPtrType.ToString());
            VerifyFieldOrProperty(fnPtrType);

            fnPtrType = p.GetModifiedPropertyType();