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

Address couple trim warnings #1272

Merged
merged 5 commits into from
Nov 15, 2022
Merged

Conversation

manodasanW
Copy link
Member

@manodasanW manodasanW commented Nov 15, 2022

  • The delegate in IDisposable seems to cause trim warnings when used in RegisterCustomAbiTypeMappingNoLock. It doesn't seem to be used, so removed it and confirmed the warnings went away.
  • Improved trim warning for C#/WinRT authoring support.

Fix #1269

@manodasanW manodasanW requested a review from j0shuams November 15, 2022 15:53
@manodasanW manodasanW merged commit 3dcca78 into master Nov 15, 2022
@manodasanW manodasanW deleted the manodasanw/disposabledelegate branch November 15, 2022 23:07
@jkoritzinsky
Copy link
Member

Are you sure this addresses the trim warning I mentioned? I could have sworn the issue was the typeof(EventHandler<>) that was causing the issue.

@manodasanW
Copy link
Member Author

Are you sure this addresses the trim warning I mentioned? I could have sworn the issue was the typeof(EventHandler<>) that was causing the issue.

I confirmed with a repro I got and then updated it to 2.0.1-prerelease.221115.11 and no longer saw those warnings. We can use the same build to confirm with @Sergio0694 's repro. If you look at it, you will note that typeof(EventHandler<>) is passed for publicType which has no DynamicallyAccessedMembers markings. It is the abiType which does which is getting our ABI version of that type. The only warning left I see is for GetAuthoringMetadataType which I put a better warning for now.

        private static void RegisterCustomAbiTypeMappingNoLock(
            Type publicType,
#if NET
            [DynamicallyAccessedMembers(
                DynamicallyAccessedMemberTypes.PublicMethods |
                DynamicallyAccessedMemberTypes.NonPublicMethods |
                DynamicallyAccessedMemberTypes.PublicNestedTypes |
                DynamicallyAccessedMemberTypes.PublicFields)]
#endif
            Type abiType, 
            string winrtTypeName,
            bool isRuntimeClass = false)

@jkoritzinsky
Copy link
Member

It's possible that I was looking at the wrong thing. Looks like you fixed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spurious trimmer warning is not suppressed
3 participants