Skip to content

Conversation

@agocke
Copy link
Member

@agocke agocke commented Jul 27, 2022

Annotates for RequiresDynamicCode, which represents AOT safety.

Annotates for RequiresDynamicCode, which represents AOT safety.
@agocke agocke requested a review from LakshanF July 27, 2022 00:03
@ghost
Copy link

ghost commented Jul 27, 2022

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost
Copy link

ghost commented Jul 27, 2022

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

Issue Details

Annotates for RequiresDynamicCode, which represents AOT safety.

Author: agocke
Assignees: -
Labels:

area-System.Linq, new-api-needs-documentation

Milestone: -

@eiriktsarpalis eiriktsarpalis added this to the 7.0.0 milestone Jul 27, 2022
@agocke
Copy link
Member Author

agocke commented Jul 29, 2022

@LakshanF for review

Copy link
Contributor

@LakshanF LakshanF left a comment

Choose a reason for hiding this comment

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

LGTM, the only FB I have is on the guidance for the user to use instead of as we generally do or perhaps in this case, warn them off this capability altogether.

{
private static MethodInfo? s_Aggregate_TSource_2;

[RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")]
Copy link
Contributor

Choose a reason for hiding this comment

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

This message might not be very user friendly in terms to what the problem is and how to work around it

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an internal class so I don't think we need to be more specific.

public static class Queryable
{
internal const string InMemoryQueryableExtensionMethodsRequiresUnreferencedCode = "Enumerating in-memory collections as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to fail at runtime.";
internal const string InMemoryQueryableExtensionMethodsRequiresDynamicCode = "Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.";
Copy link
Contributor

Choose a reason for hiding this comment

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

Any options that we can recommend to the user to use instead of?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know of any, and there aren't any suggestions for trimming, so I don't think we'll add any here.

@agocke agocke merged commit 1f0571e into dotnet:main Jul 30, 2022
@agocke agocke deleted the linq-annotate branch July 30, 2022 00:40
@ghost ghost locked as resolved and limited conversation to collaborators Aug 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants