Skip to content
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

Bubble up formatter trim warnings #11023

Merged
merged 9 commits into from
Mar 18, 2024
Merged

Conversation

LakshanF
Copy link
Member

@LakshanF LakshanF commented Mar 11, 2024

Bubbling up trim warnings to the public surface or to the binding feature boundary area seen by the TrimTest project. This is the first iteration of getting the TrimTest project warnings towards zero as discussed here. Binding feature boundary is guarded by a feature check and added a RUC to BindingContext setter so as to generate warnings when using binding in WinForms trimming. The intention is applications like TrimTest that doesn't use binding will not generate warnings but applications that do use binding will get warnings at build time (when they use BindingContext ). The runtime behavior will be a throw for trimmed WinForms applications if they use binding.

Microsoft Reviewers: Open in CodeFlow

@LakshanF LakshanF self-assigned this Mar 11, 2024
@LakshanF LakshanF requested a review from a team as a code owner March 11, 2024 17:55
Copy link

codecov bot commented Mar 11, 2024

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 73.34303%. Comparing base (fd95fcd) to head (7ca07fb).
Report is 3 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #11023         +/-   ##
===================================================
+ Coverage   73.22354%   73.34303%   +0.11948%     
===================================================
  Files           3096        3094          -2     
  Lines         633620      632450       -1170     
  Branches       47336       46945        -391     
===================================================
- Hits          463959      463858        -101     
+ Misses        166112      165110       -1002     
+ Partials        3549        3482         -67     
Flag Coverage Δ
Debug 73.34303% <22.22222%> (+0.11948%) ⬆️
integration 18.46261% <22.22222%> (+0.04268%) ⬆️
production 46.84423% <22.22222%> (+0.13377%) ⬆️
test 94.98048% <ø> (+0.00097%) ⬆️
unit 43.72135% <22.22222%> (+0.10486%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@LakshanF LakshanF requested a review from sbomer March 11, 2024 20:22
@@ -263,6 +268,7 @@ internal static class Formatter
/// - Uses TypeConverters or IConvertible where appropriate
/// - Throws a FormatException if no suitable conversion can be found
/// </summary>
[RequiresUnreferencedCode(ComponentModelTrimIncompatibilityMessage)]
Copy link
Member

Choose a reason for hiding this comment

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

Is this code path hit at runtime by the test app? I don't know whether we should bubble up warnings, or carve out a trim-compatible path through this method. If we bubble it up, I'd like to understand where we are going to cut off the annotations so that the test app doesn't hit warnings due to this.

Copy link
Member Author

Choose a reason for hiding this comment

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

ParseObjectInternal path is not hit at runtime. Added feature guards on the call stack path that reach the binding boundary. FormatObjectInternal is hit at runtime by the runtime app and bubbled up its RUC to publish methods.

Copy link
Member

@KlausLoeffelmann KlausLoeffelmann left a comment

Choose a reason for hiding this comment

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

Just had two suggestions for making messages a bit clearer - otherwise fine!

LakshanF and others added 2 commits March 18, 2024 12:02
Co-authored-by: Klaus Löffelmann <9663150+KlausLoeffelmann@users.noreply.github.com>
Copy link
Member

@KlausLoeffelmann KlausLoeffelmann left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Member

@KlausLoeffelmann KlausLoeffelmann left a comment

Choose a reason for hiding this comment

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

:shipit:

@LakshanF LakshanF merged commit e59c8ab into dotnet:main Mar 18, 2024
8 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0 Preview3 milestone Mar 18, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants