This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Repository navigation
Fix marking types inside custom attributes. Fixes #47064 - #7
Merged
Merged
Conversation
The existing code for marking custom attributes was only marking the type and the lowest element type, i.e. marking (1) would also mark (3) but would miss (2). 1. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[][]))] 2. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[]))] 3. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>))] That's generally not an issue since the type is marked (elsewhere). However, in the case of custom attributes, we need to update the Scope to what was resolved (and that was missed). That lack of updated Scope means that a PCL assembly would still keep references to System.Runtime, which is something that the linker is eliminating (causing a TypeLoadException at runtime) reference: * https://bugzilla.xamarin.com/show_bug.cgi?id=47064
|
Hi @spouliot, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution! The agreement was validated by .NET Foundation and real humans are currently evaluating your PR. TTYL, DNFBOT; |
spouliot
added a commit
to spouliot/mono
that referenced
this pull request
Dec 9, 2016
The existing code for marking custom attributes was only marking the type and the lowest element type, i.e. marking (1) would also mark (3) but would miss (2). 1. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[][]))] 2. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[]))] 3. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>))] That's generally not an issue since the type is marked (elsewhere). However, in the case of custom attributes, we need to update the Scope to what was resolved (and that was missed). That lack of updated Scope means that a PCL assembly would still keep references to System.Runtime, which is something that the linker is eliminating (causing a TypeLoadException at runtime) reference: * https://bugzilla.xamarin.com/show_bug.cgi?id=47064 Note: The linker is not in mono/master and there's a PR in the new linker repo for the same dotnet/linker#7
Member
|
Don't mind the failing build yet - the ci is still being set up. :) |
Member
|
test ci please |
spouliot
added a commit
to mono/mono
that referenced
this pull request
Dec 16, 2016
The existing code for marking custom attributes was only marking the type and the lowest element type, i.e. marking (1) would also mark (3) but would miss (2). 1. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[][]))] 2. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[]))] 3. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>))] That's generally not an issue since the type is marked (elsewhere). However, in the case of custom attributes, we need to update the Scope to what was resolved (and that was missed). That lack of updated Scope means that a PCL assembly would still keep references to System.Runtime, which is something that the linker is eliminating (causing a TypeLoadException at runtime) reference: * https://bugzilla.xamarin.com/show_bug.cgi?id=47064 Note: The linker is not in mono/master and there's a PR in the new linker repo for the same dotnet/linker#7
Contributor
|
LGTM |
joshpeterson
pushed a commit
to Unity-Technologies/mono
that referenced
this pull request
Jan 6, 2017
The existing code for marking custom attributes was only marking the type and the lowest element type, i.e. marking (1) would also mark (3) but would miss (2). 1. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[][]))] 2. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>[]))] 3. [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.Dictionary<string, object>))] That's generally not an issue since the type is marked (elsewhere). However, in the case of custom attributes, we need to update the Scope to what was resolved (and that was missed). That lack of updated Scope means that a PCL assembly would still keep references to System.Runtime, which is something that the linker is eliminating (causing a TypeLoadException at runtime) reference: * https://bugzilla.xamarin.com/show_bug.cgi?id=47064 Note: The linker is not in mono/master and there's a PR in the new linker repo for the same dotnet/linker#7
Contributor
|
@spouliot Would you like to merge this PR? |
Contributor
|
@dotnet-bot retest please |
Contributor
Author
|
Sorry :) we're not yet using this repo so it fell under my radar |
jtschuster
added a commit
to jtschuster/linker
that referenced
this pull request
Jan 19, 2022
parent ea177be author Jackson Schuster <[email protected]> 1642552698 -0800 committer Jackson Schuster <[email protected]> 1642552698 -0800 Add Function to parse xml and return a list of injected attributes Finalize schema so all test xml is valid Add restrictions on some attributes and change uses of "nothing" to "none" Remove schema reference in generated file expectation Initial Schema work # This is the commit message dotnet#6: Add restrictions on some attributes and change uses of "nothing" to "none" # This is the commit message dotnet#7: Adds a more restrictive schema for LinkAttributes and updates paths for linux # This is the commit message dotnet#9: Update docs to use 'none' instead of 'nothing' # This is the commit message dotnet#10: remove schema from xml expectation file
tkapin
pushed a commit
to tkapin/runtime
that referenced
this pull request
Jan 31, 2023
…rays Fix marking types inside custom attributes. Fixes dotnet/linker#47064 Commit migrated from dotnet/linker@c85ac36
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The existing code for marking custom attributes was only marking the type
and the lowest element type, i.e. marking (1) would also mark (3) but
would miss (2).
That's generally not an issue since the type is marked (elsewhere).
However, in the case of custom attributes, we need to update the Scope
to what was resolved (and that was missed).
That lack of updated Scope means that a PCL assembly would still keep
references to System.Runtime, which is something that the linker is
eliminating (causing a TypeLoadException at runtime)
reference: