Repository navigation
ILLink: keep base-type interfaces when a derived type is relevant to variant casting - #135961
Merged
Merged
Conversation
|
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. |
…d type Co-authored-by: jtschuster <36744439+jtschuster@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue with ILLink stripping interfaces of uninstantiated generics
ILLink: keep base-type interfaces when a derived type is relevant to variant casting
Oct 16, 2026
jtschuster
reviewed
Oct 16, 2026
Co-authored-by: jtschuster <36744439+jtschuster@users.noreply.github.com>
jtschuster
reviewed
Oct 16, 2026
jtschuster
reviewed
Oct 16, 2026
…ntries are handled Co-authored-by: jtschuster <36744439+jtschuster@users.noreply.github.com>
Member
|
@copilot ilcompiler tests are failing. Make sure they pass before pushing. |
…ler tests pass Co-authored-by: jtschuster <36744439+jtschuster@users.noreply.github.com>
Contributor
Author
Fixed in ae2dad5. The failing |
This was referenced Oct 16, 2026
jtschuster
marked this pull request as ready for review
October 19, 2026 18:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A type reached only through
typeofis marked relevant to variant casting, and its marked interface implementations are kept. Its uninstantiated base type was not marked, so the base lost its interface implementations and explicit implementation methods (e.g.IEnumerable.GetEnumerator) while the derived type kept the same interfaces. The trimmed derived type then fails to load withTypeLoadException.MarkStep.MarkRelevantToVariantCasting_typeMapHandler.ProcessTypeis still only invoked for the type itself, so type-map behavior for base types is unchanged.Inheritance.Interfaces/OnReferenceType/UninstantiatedGenericBaseWithInterfacesAndDerivedInterface.cs. It mirrors the repro with custom interfaces and an explicit implementation onBase<T>.Base<T>loses its interfaces and the explicit method whileDerived<T>keeps them.Behavior change: base types of any reflection-visible (
typeof/ldtoken) type now keep their marked interface implementations even when never instantiated. This costs a small amount of size and avoids the load failure.