Skip to content

Conversation

@eerhardt
Copy link
Member

@eerhardt eerhardt commented Jul 28, 2020

When Debugger.IsSupported feature switch is false, we trim unnecessary attributes in the code - specifically attributes like CompilerGeneratedAttribute and StackTraceHiddenAttribute. However, we still have code accessing these attributes, which causes the ILLinker to warn that it is removing the attributes, but code still uses them.

To fix this, remove these attributes from being trimmed when Debugger.IsSupported is false. Instead these attributes will be preserved always so things like "is anonymous type" checks and stack trace tostring will behave correctly.

Fix #39707

@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@ghost
Copy link

ghost commented Jul 28, 2020

Tagging subscribers to this area: @tommcdon, @krwq
See info in area-owners.md if you want to be subscribed.

…is false

When Debugger.IsSupported feature switch is false, we trim unnecessary attributes in the code - specifically attributes like CompilerGeneratedAttribute and StackTraceHiddenAttribute. However, we still have code accessing these attributes, which causes the ILLinker to warn that it is removing the attributes, but code still uses them.

To fix this, remove these attributes from being trimmed when Debugger.IsSupported is false. Instead these attributes will be preserved always so things like "is anonymous type" checks and stack trace tostring will behave correctly.

Fix dotnet#39707
@eerhardt eerhardt force-pushed the FixDebuggerAttributesWarning branch from dd9809a to 751e24a Compare July 30, 2020 23:08
@eerhardt
Copy link
Member Author

Thanks everyone for the feedback. I am now removing CompilerGeneratedAttribute and StackTraceHiddenAttribute from the list of attributes being trimmed by the linker when Debugger.IsSupported is false. These attributes will always be preserved in the assemblies.

fyi - @marek-safar

@marek-safar
Copy link
Contributor

@eerhardt what is the negative size impact of this change for Blazor and how are we going to mitigate it?

@eerhardt
Copy link
Member Author

what is the negative size impact of this change for Blazor

Uncompressed IL Compressed IL (.br)
master 2,412,032 bytes 847,333 bytes
PR 2,423,808 bytes 850,780 bytes
Difference 11,776 bytes (11.5 KB) 3,447 bytes (3.4 KB)

and how are we going to mitigate it?

I am not sure it is necessary to mitigate it. 3 KB compressed is a pretty minimal change when the total compressed app size is around 2.2 MB.

@eerhardt
Copy link
Member Author

Test failures are #40178. I believe this is ready to merge. Any other feedback?

@eerhardt eerhardt merged commit ce80850 into dotnet:master Aug 2, 2020
@eerhardt eerhardt deleted the FixDebuggerAttributesWarning branch August 2, 2020 18:00
Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
…is false (dotnet#40048)

When Debugger.IsSupported feature switch is false, we trim unnecessary attributes in the code - specifically attributes like CompilerGeneratedAttribute and StackTraceHiddenAttribute. However, we still have code accessing these attributes, which causes the ILLinker to warn that it is removing the attributes, but code still uses them.

To fix this, remove these attributes from being trimmed when Debugger.IsSupported is false. Instead these attributes will be preserved always so things like "is anonymous type" checks and stack trace tostring will behave correctly.

Fix dotnet#39707
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Removal of debugger attributes causes linker warnings in code which refers to those attributes

9 participants