Skip to content

[mono] Fix the formatting of field types FieldInfo.ToString () so it … #88648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
<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" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public override object[] GetCustomAttributes(Type attributeType, bool inherit)

public override string ToString()
{
return $"{FieldType} {name}";
return $"{FieldType.FormatTypeName ()} {name}";
}

[MethodImplAttribute(MethodImplOptions.InternalCall)]
Expand Down