-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Closed
Copy link
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzersin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
Currently we track each assignment pattern based on its Origin - which really means method + IL offset. So if the system reports two assignment patterns for the same IL offset we'll treat them as the same assignment operation (and merge the values as per the recent multi-method scanning). This causes problems if there are two out parameters for the same callsite:
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)]
static Type _publicMethodsField;
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)]
static Type _publicPropertiesField;
static void TwoOutRefs(
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)]
out Type publicMethods,
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)]
out Type publicProperties)
{
publicMethods = null;
publicProperties = null;
}
public static void Test()
{
// IL2069 since we think the value from publicMethods parameter is assigned to _publicPropertiesField
TwoOutRefs (out _publicMethodsField, out _publicPropertiesField);
}Out (and ref) parameters get assignments after each method call (source value if the parameter value of the called method). In this both assignments will have the same Origin (the same callsite) and thus will be merged. If the annotations between the two parameters don't match this will produce warnings.
Metadata
Metadata
Assignees
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzersin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Type
Projects
Status
No status