Skip to content

Commit 5d30e6d

Browse files
authored
[mono] Support function pointer reflection introspection API (#89712)
Fixes #71095
1 parent e8c46c2 commit 5d30e6d

File tree

21 files changed

+470
-102
lines changed

21 files changed

+470
-102
lines changed

src/libraries/Common/tests/System/FunctionPointerCallingConventionTests.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public partial class FunctionPointerCallingConventionTests
1515
[Theory]
1616
[InlineData(true)]
1717
[InlineData(false)]
18-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
1918
public static unsafe void ManagedCallingConvention(bool modified)
2019
{
2120
Type t = typeof(FunctionPointerHolder).Project();
@@ -36,7 +35,6 @@ public static unsafe void ManagedCallingConvention(bool modified)
3635
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Stdcall))]
3736
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Thiscall))]
3837
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Fastcall))]
39-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
4038
public static unsafe void UnmanagedCallConv_Param_Unmodified(string methodName)
4139
{
4240
Type t = typeof(FunctionPointerHolder).Project();
@@ -54,7 +52,6 @@ public static unsafe void UnmanagedCallConv_Param_Unmodified(string methodName)
5452
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Stdcall), typeof(CallConvStdcall))]
5553
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Thiscall), typeof(CallConvThiscall))]
5654
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Fastcall), typeof(CallConvFastcall))]
57-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
5855
public static unsafe void UnmanagedCallConv_Param_Modified(string methodName, Type callingConventionRuntime)
5956
{
6057
Type callingConvention = callingConventionRuntime.Project();
@@ -71,7 +68,7 @@ public static unsafe void UnmanagedCallConv_Param_Modified(string methodName, Ty
7168
}
7269

7370
[Fact]
74-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
71+
[ActiveIssue("https://github.com/dotnet/runtime/issues/90308", TestRuntimes.Mono)]
7572
public static unsafe void UnmanagedCallConvs_Return_Unmodified()
7673
{
7774
Type t = typeof(FunctionPointerHolder).Project();
@@ -91,7 +88,6 @@ public static unsafe void UnmanagedCallConvs_Return_Unmodified()
9188
}
9289

9390
[Fact]
94-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
9591
public static unsafe void UnmanagedCallConvs_Return_Modified()
9692
{
9793
Type t = typeof(FunctionPointerHolder).Project();
@@ -118,7 +114,6 @@ public static unsafe void UnmanagedCallConvs_Return_Modified()
118114
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Stdcall_SuppressGCTransition))]
119115
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Thiscall_SuppressGCTransition))]
120116
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Fastcall_SuppressGCTransition))]
121-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
122117
public static unsafe void UnmanagedCallConv_PhysicalModifiers_Unmodified(string methodName)
123118
{
124119
Type t = typeof(FunctionPointerHolder).Project();
@@ -137,7 +132,6 @@ public static unsafe void UnmanagedCallConv_PhysicalModifiers_Unmodified(string
137132
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Stdcall_SuppressGCTransition), typeof(CallConvStdcall))]
138133
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Thiscall_SuppressGCTransition), typeof(CallConvThiscall))]
139134
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Fastcall_SuppressGCTransition), typeof(CallConvFastcall))]
140-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
141135
public static unsafe void UnmanagedCallConv_PhysicalModifiers_Modified(string methodName, Type callingConventionRuntime)
142136
{
143137
Type suppressGcTransitionType = typeof(CallConvSuppressGCTransition).Project();
@@ -161,7 +155,6 @@ public static unsafe void UnmanagedCallConv_PhysicalModifiers_Modified(string me
161155
}
162156

163157
[Fact]
164-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
165158
public static unsafe void GenericTypeParameter()
166159
{
167160
Type holder = typeof(FunctionPointerHolder).Project();

src/libraries/Common/tests/System/FunctionPointerEqualityTests.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public partial class FunctionPointerEqualityTests
1515
private const BindingFlags Bindings = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
1616

1717
[Fact]
18-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
1918
public static unsafe void DifferentReturnValue()
2019
{
2120
Type t = typeof(FunctionPointerHolder).Project();
@@ -31,7 +30,6 @@ public static unsafe void DifferentReturnValue()
3130
}
3231

3332
[Fact]
34-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
3533
public static unsafe void ObjectEquals_ModifiedTypes()
3634
{
3735
Type holder = typeof(FunctionPointerHolder).Project();
@@ -47,7 +45,6 @@ public static unsafe void ObjectEquals_ModifiedTypes()
4745
}
4846

4947
[Fact]
50-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
5148
public static unsafe void ObjectEquals_OneSideModifiedType()
5249
{
5350
Type holder = typeof(FunctionPointerHolder).Project();
@@ -65,7 +62,7 @@ public static unsafe void ObjectEquals_OneSideModifiedType()
6562
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Stdcall))]
6663
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Thiscall))]
6764
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Fastcall))]
68-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
65+
[ActiveIssue("https://github.com/dotnet/runtime/issues/90308", TestRuntimes.Mono)]
6966
public static unsafe void CallingConvention_Unmodified(string methodName1, string methodName2)
7067
{
7168
Type t = typeof(FunctionPointerHolder).Project();
@@ -83,7 +80,6 @@ public static unsafe void CallingConvention_Unmodified(string methodName1, strin
8380
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Stdcall))]
8481
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Thiscall))]
8582
[InlineData(nameof(FunctionPointerHolder.MethodCallConv_Cdecl), nameof(FunctionPointerHolder.MethodCallConv_Fastcall))]
86-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
8783
public static unsafe void CallingConvention_Modified(string methodName1, string methodName2)
8884
{
8985
Type t = typeof(FunctionPointerHolder).Project();

src/libraries/Common/tests/System/FunctionPointerTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public partial class FunctionPointerTests
1414
private const BindingFlags Bindings = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
1515

1616
[Fact]
17-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
1817
public static unsafe void TypeMembers()
1918
{
2019
// Get an arbitrary function pointer
@@ -116,7 +115,6 @@ public static unsafe void TypeMembers()
116115
}
117116

118117
[Fact]
119-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
120118
public static unsafe void NonFunctionPointerThrows()
121119
{
122120
Assert.Throws<InvalidOperationException>(() => typeof(int).GetFunctionPointerCallingConventions());
@@ -125,7 +123,6 @@ public static unsafe void NonFunctionPointerThrows()
125123
}
126124

127125
[Fact]
128-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
129126
public static unsafe void TestToString()
130127
{
131128
// Function pointer types are inline in metadata and can't be loaded independently so they do not support the
@@ -146,7 +143,6 @@ public static unsafe void TestToString()
146143
}
147144

148145
[Fact]
149-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
150146
public static unsafe void FunctionPointerReturn()
151147
{
152148
Type t = typeof(FunctionPointerHolder).Project();
@@ -163,7 +159,6 @@ public static unsafe void FunctionPointerReturn()
163159
}
164160

165161
[Fact]
166-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
167162
public static unsafe void RequiredModifiers()
168163
{
169164
Type t = typeof(FunctionPointerHolder).Project();
@@ -188,7 +183,6 @@ public static unsafe void RequiredModifiers()
188183
"Double",
189184
"System.Double(System.String, System.Boolean*&, System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyClass, System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyStruct&)",
190185
"String", "Boolean*&", "MyClass", "MyStruct&")]
191-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
192186
public static unsafe void MethodInfo(
193187
string methodName,
194188
string methodToStringPostfix,
@@ -216,7 +210,6 @@ public static unsafe void MethodInfo(
216210
[Theory]
217211
[InlineData(nameof(FunctionPointerHolder.Prop_Int), "System.Int32()")]
218212
[InlineData(nameof(FunctionPointerHolder.Prop_MyClass), "System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyClass()")]
219-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
220213
public static unsafe void Property(string name, string expectedToString)
221214
{
222215
Type t = typeof(FunctionPointerHolder).Project();
@@ -235,7 +228,6 @@ public static unsafe void Property(string name, string expectedToString)
235228
[Theory]
236229
[InlineData(nameof(FunctionPointerHolder.Field_Int), "System.Int32()")]
237230
[InlineData(nameof(FunctionPointerHolder.Field_MyClass), "System.Tests.Types.FunctionPointerTests+FunctionPointerHolder+MyClass()")]
238-
[ActiveIssue("https://github.com/dotnet/runtime/issues/71095", TestRuntimes.Mono)]
239231
public static unsafe void Field(string name, string expectedToString)
240232
{
241233
Type t = typeof(FunctionPointerHolder).Project();

0 commit comments

Comments
 (0)