Fixes https://github.com/dotnet/runtime/issues/88637.
<Compile Include="System\Reflection\InvokeRefReturn.cs" />
<Compile Include="System\Reflection\InvokeWithRefLikeArgs.cs" />
<Compile Include="System\Reflection\IsCollectibleTests.cs" />
+ <Compile Include="System\Reflection\FieldInfoTests.cs" />
<Compile Include="System\Reflection\MethodBaseTests.cs" />
<Compile Include="System\Reflection\MethodBodyTests.cs" />
<Compile Include="System\Reflection\ModuleTests.cs" />
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Collections.Generic;
+using Xunit;
+using TestAttributes;
+
+namespace System.Reflection.Tests
+{
+ public class FieldInfoTests
+ {
+ public int int_field;
+
+ [Fact]
+ public void ToStringFieldType()
+ {
+ Assert.Equal("Int32 int_field", typeof(FieldInfoTests).GetField("int_field").ToString());
+ }
+ }
+}
public override string ToString()
{
- return $"{FieldType} {name}";
+ return $"{FieldType.FormatTypeName ()} {name}";
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]