-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-VM-reflection-monoReflection issues specific to MonoVMReflection issues specific to MonoVMos-android
Milestone
Description
Description
Issue started from dotnet/android#7445
Type.GetRuntimeProperties(), Type.GetProperties(..), etc. don't return internal properties that are defined in a base class of the given type when running on net6.0-android. When I run the same code as a net6.0 console application or a Xamarin.Android app, the properties are correctly returned.
Reproduction Steps
- Create a new .NET 6 Android application. Add the code below and run the
Test.Executemethod.
public static class Test
{
public static void Execute()
{
var obj = new Class2();
var properties = obj.GetType().GetRuntimeProperties();
var names = properties.Select(x => x.Name).ToList();
Console.WriteLine($"Found {names.Count} properties: {string.Join(", ", names)}");
// Xamarin.Android: Found 2 properties: TestProp2, TestProp1
// net6.0: Found 2 properties: TestProp2, TestProp1
// net6.0-android: Found 1 properties: TestProp2
}
}
public class Class1
{
internal int TestProp1 { get; set; }
}
public class Class2 : Class1
{
internal int TestProp2 { get; set; }
}
Expected behavior
The sample should produce Found 2 properties: TestProp2, TestProp1 as output
Actual behavior
The output produces Found 1 properties: TestProp2
Regression?
In terms of migrating from xamarin-android to .net android, yes.
Known Workarounds
No response
Configuration
net6-android, VS 2022 17.3.5
Other information
No response
Metadata
Metadata
Assignees
Labels
area-VM-reflection-monoReflection issues specific to MonoVMReflection issues specific to MonoVMos-android