-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Open
Labels
area-System.Reflectionbreaking-changeIssue or PR that represents a breaking API or functional change over a prerelease.Issue or PR that represents a breaking API or functional change over a prerelease.needs-breaking-change-doc-createdBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnetBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet
Milestone
Description
Description
When trying to get the IsInterface
member System.Runtimetype
we get back an empty array of MemberInfo
.
Expected to have 1 item in the array
Reproduction Steps
Project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
Program.cs:
using System.IO;
var t = typeof(Path).Assembly.GetType("System.IO.Path");
Console.WriteLine($"Value == {t?.IsInterface}");
Console.WriteLine($"{t?.GetType()}");
var member = t?.GetType().GetMember("IsInterface");
if (member is not null)
{
Console.WriteLine($"{member.GetType()}");
Console.WriteLine($"{member.Length}");
}
Expected behavior
Value == False
System.RuntimeType
System.Reflection.MemberInfo[]
1
Actual behavior
Value == False
System.RuntimeType
System.Reflection.MemberInfo[]
0
Regression?
This is a regression from .NET 8
Known Workarounds
None
Configuration
.NET 9 Preview 1
Failures happen on Windows, Linux and Mac
Other information
No response
Metadata
Metadata
Assignees
Labels
area-System.Reflectionbreaking-changeIssue or PR that represents a breaking API or functional change over a prerelease.Issue or PR that represents a breaking API or functional change over a prerelease.needs-breaking-change-doc-createdBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnetBreaking changes need an issue opened with https://github.com/dotnet/docs/issues/new?template=dotnet