Skip to content

Commit d90d17c

Browse files
committed
Added test for auto property; crashes in ves_icall_RuntimePropertyInfo_get_property_info
1 parent 6e9811d commit d90d17c

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.AddInstanceField/AddInstanceField.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ public void IncRefDouble (ref double d)
3131
d += 1.0;
3232
}
3333

34+
public string GetStringProp => string.Empty;
3435
}
3536
}

src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.AddInstanceField/AddInstanceField_v1.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public AddInstanceField () {
1717
// a little bit ldflda testing
1818
IncRefDouble (ref NewStructField.D);
1919
IncRefDouble (ref _doubleField2);
20+
21+
AddedStringAutoProp = "abcd";
2022
}
2123

2224
public void IncRefDouble (ref double d)
@@ -40,6 +42,7 @@ public void TestMethod () {
4042
_stringField2 = "4567";
4143
_doubleField = 2.71828;
4244
_doubleField2 = 0.707106;
45+
AddedStringAutoProp = AddedStringAutoProp + "Test";
4346
}
4447

4548
public int GetIntArrayLength() => _intArrayFieldWithInit2?.Length ?? -1;
@@ -52,5 +55,11 @@ public struct NewStruct
5255
}
5356

5457
public NewStruct NewStructField;
58+
59+
public string GetStringProp => AddedStringAutoProp;
60+
61+
public string AddedStringAutoProp { get; set; }
62+
63+
5564
}
5665
}

src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,18 @@ public static void TestAddInstanceField()
369369
Assert.Equal (32768.2, x2.GetDoubleField);
370370
Assert.Equal ((object)32768.2, fi.GetValueDirect (tr));
371371

372+
Assert.Equal("abcd", x2.GetStringProp);
373+
374+
var propInfo = x2.GetType().GetProperty("AddedStringAutoProp", BindingFlags.Public | BindingFlags.Instance);
375+
376+
Assert.NotNull(propInfo);
377+
Assert.Equal("abcd", propInfo.GetMethod.Invoke (x2, new object[] {}));
378+
379+
x2.TestMethod();
380+
381+
Assert.Equal("abcdTest", x2.GetStringProp);
382+
383+
372384
});
373385
}
374386

0 commit comments

Comments
 (0)