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

Fix IL2087 trim warning in 'ObjectReferenceWithContext<T>' #1577

Merged
merged 7 commits into from
Apr 26, 2024

Conversation

Sergio0694
Copy link
Member

Discovered while testing #1573. This PR fixes:

ILC : Trim analysis warning IL2087: WinRT.ObjectReferenceWithContext1.<GetCurrentContext>g__CreateForCurrentContext|19_0(IntPtr): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicFields' in call to 'WinRT.GuidGenerator.GetIID(Type)'. The generic parameter 'T' of 'WinRT.ObjectReferenceWithContext1' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

Related to: dotnet/runtime#101203.

This PR includes two changes:

  • Add the right annotations to ObjectReferenceWithContext<T>.
  • Pass an IID explicitly wherever possible.

@Sergio0694 Sergio0694 requested a review from manodasanW April 18, 2024 22:15
@Sergio0694 Sergio0694 marked this pull request as draft April 18, 2024 22:47
@Sergio0694 Sergio0694 marked this pull request as ready for review April 18, 2024 22:57
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/fix-obj-ref-trim-warning branch 4 times, most recently from fb6e682 to 088ff41 Compare April 24, 2024 16:45
* Skip closure allocation in ObjectReferenceWithContext<T>

* Remove even more closure allocations in ObjectReferenceWithContext<T> (#1589)

* Skip closures for 'Context.CallInContext' calls

* Use function pointers instead of delegates

* Move context lambda to FOH
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/fix-obj-ref-trim-warning branch from b3ae801 to 849bc0c Compare April 26, 2024 15:12
@Sergio0694 Sergio0694 merged commit 541747c into staging/AOT Apr 26, 2024
10 checks passed
@Sergio0694 Sergio0694 deleted the user/sergiopedri/fix-obj-ref-trim-warning branch April 26, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants