Skip to content

Conversation

jander-msft
Copy link
Contributor

A recent change in #87490 causes two ILLink warnings to be emitted for the same issue (enabling startup hooks in trimmed applications):

ILLink : Trim analysis warning IL2026: System.StartupHookProvider.CallStartupHook(Char*): Using member 'System.StartupHookProvider.CallStartupHook(StartupHookProvider.StartupHookNameOrPath)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The StartupHookSupport feature switch has been enabled for this app which is being trimmed. Startup hook code is not observable by the trimmer and so required assemblies, types and members may be removed. 
ILLink : Trim analysis warning IL2026: System.StartupHookProvider.ProcessStartupHooks(String): Using member 'System.StartupHookProvider.CallStartupHook(StartupHookProvider.StartupHookNameOrPath)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The StartupHookSupport feature switch has been enabled for this app which is being trimmed. Startup hook code is not observable by the trimmer and so required assemblies, types and members may be removed. 

This is causing test failures in the SDK repo for tests that are counting warnings. More importantly (arguably), this almost looks like a duplicate warning to developer who enables startup hooks in their trimmed applications and the mitigations are exactly the same.

This change unconditionally suppresses the IL2026 since it is already covered by the warning for ProcessStartupHooks.

@ghost ghost added needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners community-contribution Indicates that the PR has been added by a community member labels Jun 19, 2023
@marek-safar marek-safar added the linkable-framework Issues associated with delivering a linker friendly framework label Jun 19, 2023
@ghost
Copy link

ghost commented Jun 19, 2023

Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr, @marek-safar
See info in area-owners.md if you want to be subscribed.

Issue Details

A recent change in #87490 causes two ILLink warnings to be emitted for the same issue (enabling startup hooks in trimmed applications):

ILLink : Trim analysis warning IL2026: System.StartupHookProvider.CallStartupHook(Char*): Using member 'System.StartupHookProvider.CallStartupHook(StartupHookProvider.StartupHookNameOrPath)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The StartupHookSupport feature switch has been enabled for this app which is being trimmed. Startup hook code is not observable by the trimmer and so required assemblies, types and members may be removed. 
ILLink : Trim analysis warning IL2026: System.StartupHookProvider.ProcessStartupHooks(String): Using member 'System.StartupHookProvider.CallStartupHook(StartupHookProvider.StartupHookNameOrPath)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The StartupHookSupport feature switch has been enabled for this app which is being trimmed. Startup hook code is not observable by the trimmer and so required assemblies, types and members may be removed. 

This is causing test failures in the SDK repo for tests that are counting warnings. More importantly (arguably), this almost looks like a duplicate warning to developer who enables startup hooks in their trimmed applications and the mitigations are exactly the same.

This change unconditionally suppresses the IL2026 since it is already covered by the warning for ProcessStartupHooks.

Author: jander-msft
Assignees: -
Labels:

linkable-framework, community-contribution, needs-area-label

Milestone: -

@ghost
Copy link

ghost commented Jun 19, 2023

Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.

Issue Details

A recent change in #87490 causes two ILLink warnings to be emitted for the same issue (enabling startup hooks in trimmed applications):

ILLink : Trim analysis warning IL2026: System.StartupHookProvider.CallStartupHook(Char*): Using member 'System.StartupHookProvider.CallStartupHook(StartupHookProvider.StartupHookNameOrPath)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The StartupHookSupport feature switch has been enabled for this app which is being trimmed. Startup hook code is not observable by the trimmer and so required assemblies, types and members may be removed. 
ILLink : Trim analysis warning IL2026: System.StartupHookProvider.ProcessStartupHooks(String): Using member 'System.StartupHookProvider.CallStartupHook(StartupHookProvider.StartupHookNameOrPath)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The StartupHookSupport feature switch has been enabled for this app which is being trimmed. Startup hook code is not observable by the trimmer and so required assemblies, types and members may be removed. 

This is causing test failures in the SDK repo for tests that are counting warnings. More importantly (arguably), this almost looks like a duplicate warning to developer who enables startup hooks in their trimmed applications and the mitigations are exactly the same.

This change unconditionally suppresses the IL2026 since it is already covered by the warning for ProcessStartupHooks.

Author: jander-msft
Assignees: -
Labels:

area-System.Runtime, linkable-framework, community-contribution, needs-area-label

Milestone: -

@marek-safar marek-safar removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 19, 2023
Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MichalStrehovsky MichalStrehovsky merged commit 2d082af into dotnet:main Jun 19, 2023
@jander-msft jander-msft deleted the unconditional-suppress-callstartuphook branch June 20, 2023 19:34
@ghost ghost locked as resolved and limited conversation to collaborators Jul 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Runtime community-contribution Indicates that the PR has been added by a community member linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants