Skip to content

Allow constrained. call and ldftn for static virtual interface methods in ILVerify - #132944

Open
pkuyo wants to merge 2 commits into
dotnet:mainfrom
pkuyo:fix-ilverify-132820
Open

Allow constrained. call and ldftn for static virtual interface methods in ILVerify#132944
pkuyo wants to merge 2 commits into
dotnet:mainfrom
pkuyo:fix-ilverify-132820

Conversation

@pkuyo

@pkuyo pkuyo commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #132820

ILVerify predates static virtual interface methods, so the IL Roslyn emits for T.M() (constrained. !!T followed by call) gets flagged with bogus Constrained and CallAbstract errors.

Consume the constrained. prefix on call when the target is a static virtual method on an interface, and check that the constrained type actually implements that interface (new ConstrainedTypeNoInterfaceImpl error).

Tests added to PrefixTests.il.

@github-actions github-actions Bot added the area-Tools-ILVerification Issues related to ilverify tool and IL verification in general label Aug 30, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@pkuyo pkuyo changed the title Allow constrained. call to static virtual interface methods Allow constrained. call and ldftn for static virtual interface methods in ILVerify Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Tools-ILVerification Issues related to ilverify tool and IL verification in general

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling static abstract method via type parameter generates code in C# that wont ILVerify

1 participant