Skip to content

Commit

Permalink
remove instance fields from reflection test
Browse files Browse the repository at this point in the history
since Mono doesn't support them yet
  • Loading branch information
lambdageek committed Mar 17, 2022
1 parent 9917ef3 commit 7a4c892
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ public class NewNestedClass {};

public string NewMethod (string s, int i) => s + i.ToString();

// Mono doesn't support instance fields yet
#if false
public int NewField;
#endif

public static DateTime NewStaticField;

public double NewProp { get; set; }
public static double NewProp { get; set; }
}

[AttributeUsage(AttributeTargets.All, AllowMultiple=true, Inherited=false)]
Expand Down
11 changes: 9 additions & 2 deletions src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -513,19 +513,26 @@ public static void TestReflectionAddNewType()

var allFields = ty.GetFields(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);

// Mono doesn't do instance fields yet
#if false
FieldInfo newField = null;
#endif
FieldInfo newStaticField = null;
foreach (var fld in allFields)
{
#if false
if (fld.Name == "NewField")
newField = fld;
#endif
if (fld.Name == "NewStaticField")
newStaticField = fld;
}
#if false
Assert.NotNull(newField);
Assert.NotNull(newStaticField);

Assert.Equal(newField, ty.GetField("NewField"));
#endif

Assert.NotNull(newStaticField);
Assert.Equal(newStaticField, ty.GetField("NewStaticField", BindingFlags.Static | BindingFlags.Public));

});
Expand Down

0 comments on commit 7a4c892

Please sign in to comment.