-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
ValidateInterfaceImplTable enforces bogus ordering rules #60454
Comments
Tagging subscribers to this area: @buyaa-n Issue DetailsDescriptionSystem.Reflection.Metadata metadata writer enforces made up rules around metadata validity for the InterfaceImpl table. Reproduction StepsIt's not possible to generate a module with the metadata that corresponds to the following C# program: interface I1
{
void Method();
}
interface I2
{
void Method();
}
class C1 : I1, I2
{
public void Method() { }
}
class C2 : I2, I1
{
public void Method() { }
} Expected behaviorIt's possible to generate interface list for Actual behaviorInvalidOperationException is thrown out of this code because it's impossible to have the interface list sorted both ways: Lines 1552 to 1576 in 57bfe47
Interface index should not be looked at by this code. Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
It enforces a bogus rule: dotnet/runtime#60454
It enforces a bogus rule: dotnet/runtime#60454
This is the same as dotnet/roslyn#3905, but it was incorrectly thought to be a Roslyn bug, when it is in fact a SRM and spec bug -- I think ECMA's restriction here is too strict. |
Ah, didn't see ECMA calls for it. Such rule doesn't make sense - the interface ordering affects resolution rules (see II.12.2: - "Where there are multiple implementations for a given interface method due to differences in type Removing that line from the spec should go to the ECMA-335 addendums doc in this repo. |
Description
System.Reflection.Metadata metadata writer enforces weird rules around metadata validity for the InterfaceImpl table.
Reproduction Steps
It's not possible to generate a module with the metadata that corresponds to the following C# program:
Expected behavior
It's possible to generate interface list for
I1, I2
andI2, I1
.Actual behavior
InvalidOperationException is thrown out of this code because it's impossible to have the interface list sorted both ways:
runtime/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataBuilder.Tables.cs
Lines 1552 to 1576 in 57bfe47
Interface index should not be looked at by this code.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: