Skip to content

Allow static abstract through the sandbox + INumber#6432

Open
moonheart08 wants to merge 5 commits intospace-wizards:masterfrom
moonheart08:28-02-2026-static-abstract
Open

Allow static abstract through the sandbox + INumber#6432
moonheart08 wants to merge 5 commits intospace-wizards:masterfrom
moonheart08:28-02-2026-static-abstract

Conversation

@moonheart08
Copy link
Contributor

@moonheart08 moonheart08 commented Feb 28, 2026

This allows call of static abstract methods, and the usage of .constrained on such methods, as the C# compiler does.

An example of an interface you previously could not use in content due to this is INumber<T>, from .NET 7.

This, thusly, also whitelists INumber & co.

This additionally whitelists the IParsable and IFormattable families of interfaces, also from .NET 7.

Remarks

This is not a perfect fix, but the invalid constructs it allows (namely, incorrect constrained usage, and calling abstract methods that are truly abstract) result in the CLR throwing an exception, not unexpected CLR behavior.

A perfect fix would require us to fork ILVerify, as upstream (the .NET runtime) no longer maintains it in significant capacity.

Such a fork would also potentially enable other constructs, like Span<T> foo = stackalloc T[n] and [InlineArray], to be valid in client side code.

@moonheart08 moonheart08 changed the title Allow static abstract through the sandbox Allow static abstract through the sandbox + INumber Feb 28, 2026
This was referenced Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants