Skip to content

Commit

Permalink
Remove debug only attributes when Debugger.IsSupported is false. (#39237
Browse files Browse the repository at this point in the history
)

* Remove debug only attributes when Debugger.IsSupported is false.

Contributes to dotnet/linker#1093

* Move debug only attributes to shared CoreLib.
  • Loading branch information
eerhardt authored Jul 15, 2020
1 parent cd8759d commit 78fb02b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<linker>
<!-- The following attributes are only necessary when debugging is supported -->
<assembly fullname="System.Private.CoreLib" feature="System.Diagnostics.Debugger.IsSupported" featurevalue="false">
<!-- Debugger specific attributes -->
<type fullname="System.Diagnostics.DebuggableAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.DebuggerBrowsableAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.DebuggerDisplayAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.DebuggerHiddenAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.DebuggerNonUserCodeAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.DebuggerStepperBoundaryAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.DebuggerStepThroughAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.DebuggerTypeProxyAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Diagnostics.DebuggerVisualizerAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>

<!-- Attributes used during pretty stack trace printing -->
<type fullname="System.Diagnostics.StackTraceHiddenAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CompilerGeneratedAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
</assembly>
</linker>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
Condition="'$(Platform)' == 'wasm'" />
<ILLinkSubstitutionsXmls Include="$(ILLinkSharedDirectory)ILLink.Substitutions.NoX86Intrinsics.xml"
Condition="'$(Platform)' == 'wasm'" />

<ILLinkLinkAttributesXmls Include="$(ILLinkSharedDirectory)ILLink.LinkAttributes.Shared.xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Internal\AssemblyAttributes.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.$(Platform).xml"
Condition="Exists('$(ILLinkDirectory)ILLink.Substitutions.$(Platform).xml')" />

<ILLinkLinkAttributesXmls Include="$(ILLinkDirectory)/ILLink.LinkAttributes.$(Platform).xml"
<ILLinkLinkAttributesXmls Include="$(ILLinkDirectory)ILLink.LinkAttributes.$(Platform).xml"
Condition="Exists('$(ILLinkDirectory)ILLink.LinkAttributes.$(Platform).xml')" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@
<type fullname="System.Runtime.CompilerServices.CallerMemberNameAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CompilerGeneratedAttribute" feature="System.Diagnostics.Debugger.IsSupported" featurevalue="false">
<!--
The attribute is used during pretty stack trace printing
-->
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="System.Runtime.CompilerServices.CompilerGlobalScopeAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
Expand Down Expand Up @@ -116,12 +110,12 @@
<attribute internal="RemoveAttributeInstances" />
</type>

<!-- Microsoft.ComponentModel -->
<!-- System.ComponentModel -->
<type fullname="System.ComponentModel.EditorBrowsableAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
</assembly>

<!-- The following attributes are generated by the compiler, so they could be in any assembly -->
<assembly fullname="*">
<!-- System.Runtime.CompilerServices -->
Expand Down

0 comments on commit 78fb02b

Please sign in to comment.