-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add attributes to System.Drawing.Printing.PrintDocument #35162
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
Add attributes to System.Drawing.Printing.PrintDocument #35162
Conversation
|
Tagging subscribers to this area: @safern, @tannergooding |
e6cb572 to
68e5a3e
Compare
|
@safern |
src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.Windows.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, @ericstj we've been avoiding bringing System.ComponentModel.TypeConverter closure into System.Drawing.Common, what do you suggest here, maybe pushing these two attributes down to primitives or S.ComponentModel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the attribute usage is decoupled enough from the normal use case that we should be able to add the dependency and avoid loading TypeConverter, as I mentioned here: #1011 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eerhardt what level of trimming would apps need so that TypeConverter is trimmed from the closure if we only use attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They would need to pass --used-attrs-only true (which is not the default) to the linker in order to get attributes that aren't being read to be trimmed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: The --used-attrs-only setting has issues with it, as called out in dotnet/linker#952 (comment). So I wouldn't expect high usage of this setting until those problems are fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@safern
Just to remind, please review my previous report about trying trim on System.Drawing.Common.
thanks before! 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we could push the attribute types down to a lower assembly. Either System.ComponentModel.Primitives or System.ObjectModel as @safern suggested. It's still not clear to me how important this is. One thing we could do is take this as is and then if we get feedback on app size issues (eg: if this matters for browser) then we push the types down. The thing that I'm trying to reason about is how much we care about this metric, certainly in Winforms use case we don't since both TypeConverter and Drawing will always be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericstj fair point; we can do that. Will reset CI then to make sure we get a fresh run and then merge.
68e5a3e to
3fc9fb2
Compare
3fc9fb2 to
122315d
Compare
…nt class and add references to System.ComponentModel.TypeConverter
…cument in the ref Add DefaultEventAttribute and DefaultPropertyAttribute to PrintDocument in PrintDoument.Unix.cs
122315d to
670ea8e
Compare
|
Build are green. Perf build didn't update since the interpreter build was removed from CI. |
|
Thanks @eriawan for the patience and effort! |
|
@safern |
Fixes #34696
I added DefaultEventAttribute and DefaultPropertyAttribute on PrintDocument class in System.Drawing.Printing.PrintDocument, to be in sync with .NET Framework's PrintDocument as described in #34696
@safern
I mark this as WIP, because after I opened I System.Drawing.Common.sln and did build using Visual Studio on src\libraries\src\System.Drawing.Common.csproj on my machine, I got these errors:
Is there I need to update on my side or do I miss something else?
UPDATE 1:
I think I know what I've been missing! The attributes should also be added to PrintDocument class in PrintDocument.Unix.cs as well.
I have updated my commit.