-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
area-System.Reflection.Metadatabugdesign-discussionOngoing discussion about design without consensusOngoing discussion about design without consensus
Milestone
Description
Version Used:
.NET 7.0.400-preview.23225.8
Steps to Reproduce:
Started as an investigation of jbevain/cecil#913
- Compile this absolute unit of a compilation unit as the single file of a library project: https://gist.github.com/jbevain/9599e655adad445a6ee447add305a8bc
- Reference the library in a console project:
using System.Reflection;
var a = Assembly.LoadFile(typeof(P3).Assembly.Location);
foreach (var t in a.GetTypes())
{
Console.WriteLine(t.FullName);
foreach (var m in t.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static))
{
Console.WriteLine(m.Name);
foreach (var p in m.GetParameters())
{
Console.WriteLine(p.Name);
}
}
}dotnet runthe console project:
Expected Behavior:
Should print:
...
F_65534
a
Actual Behavior:
...
F_65534
Unhandled exception. System.BadImageFormatException: File is corrupt. (0x8013110E)
at System.Reflection.MetadataImport._Enum(IntPtr scope, Int32 type, Int32 parent, MetadataEnumResult& result)
at System.Reflection.RuntimeParameterInfo.GetParameters(IRuntimeMethodInfo methodHandle, MemberInfo member, Signature sig, ParameterInfo& returnParameter, Boolean fetchReturnParameter)
at System.Reflection.RuntimeMethodInfo.GetParameters()
at Program.<Main>$(String[] args) in C:\tmp\ReproFFFF\exe\Program.cs:line 10
Note that the last row of the Method table has a Param of 0x80000000 which is unexpected:

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.Reflection.Metadatabugdesign-discussionOngoing discussion about design without consensusOngoing discussion about design without consensus