Skip to content

Reflection Method Parameter Analysis partial support2#3

Open
LakshanF wants to merge 2 commits intotlakollo:DAMUnsupportedReflectionAccessfrom
LakshanF:ExploreMethodIntrinsic2
Open

Reflection Method Parameter Analysis partial support2#3
LakshanF wants to merge 2 commits intotlakollo:DAMUnsupportedReflectionAccessfrom
LakshanF:ExploreMethodIntrinsic2

Conversation

@LakshanF
Copy link
Copy Markdown
Collaborator

This is partial since we need to handle normal invokes separately from reflection ones. The 2nd failing test case tracks the issue

@LakshanF LakshanF requested a review from tlakollo November 19, 2021 12:18

var source = DynamicallyAccessedMembersAnalyzer.TryGetSymbolFromOperation (invocationOperation.Instance, context);
if (source != null)
DynamicallyAccessedMembersAnalyzer.VerifyAnnotations (source.Value, memberTypes, context, invocationOperation.Syntax.GetLocation ());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

My BindingLogic in VerifyAnnotations is limited, for intrinsics it shouldn't be operating with the DynamicallyAccessedMembersTypes that we got from BindingFlags, it should operate directly with the binding flags since that's what the binder in Linker does. But either way, I don't think the linker will print nor keep anything with BindingFlags.CreateInstance, since is an ignored flag.
Also, I talked with Sven about this branch he suggested two things that I think are valuable, one is to divide the tasks into something more like the trimmer. Instead of filtering members and getting diagnostics in a single method, have two methods one that returns an enumeration of members (it will behave like the marking in trimmer) and another that only generates diagnostics.
The second recommendation was to divide this PR, Binding Logic + Intrinsics is an extensive change especially considering the new dataflow changes which make both tasks more complex.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm a little behind our goal :-( Pushing a fix to handle intrinsic method separately. Still partial - BindingFlags are not fully handled and need to take care of RUC, DynamicDependency, delegates and type extension annotations (need to investigate if this can be handled in the mainline).

Will have a plan to discuss at our sync up today.

bindingFlags = GetBindingFlagsFromValue (invocationOperation.Arguments[1]);
else
// Assume a default value for BindingFlags for methods that don't use BindingFlags as a parameter
bindingFlags = BindingFlags.Public;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Since the binder for intrinsics operates with BindingFlags the default BindingFlags for GetMethod are BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public

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.

2 participants