-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[main] Update dependencies from mono/linker #56593
Changes from 8 commits
4f9af86
890bcb7
43f29d7
4afe081
06b421b
a53d3d6
c353468
1a111df
03dc002
b96ed81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,8 @@ | |
|
||
namespace System.Data.Common | ||
{ | ||
// This coarse suppression silences all RequiresUnreferencedCode warnings in the class. | ||
// https://github.com/mono/linker/issues/2136 tracks making it possible to add more granular suppressions at the member level, and with a different warning code. | ||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", | ||
Justification = "The use of GetType preserves members with RequiresUnreferencedCode, but the GetType callsites either " | ||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2113:RequiresUnreferencedCode", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (nit) - This is repeated elsewhere for IL2112 in this file, and other files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My thinking was that RequiresUnreferencedCode here was about the DAM-on-type requiring methods annotated with RequiresUnreferencedCode. I renamed it to ReflectionToRequiresUnreferencedCode. Just note that some instances of IL2026 also represent ReflectionToRequiresUnreferencedCode, for instance: typeof(Foo).GetMethod("RUC"); // IL2026
class Foo {
[RUC("RUC")]
public static void RUC() {}
} |
||
Justification = "The use of GetType preserves ICustomTypeDescriptor members with RequiresUnreferencedCode, but the GetType callsites either " | ||
+ "occur in RequiresUnreferencedCode scopes, or have individually justified suppressions.")] | ||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] | ||
public class DbConnectionStringBuilder : IDictionary, ICustomTypeDescriptor | ||
|
@@ -393,6 +391,9 @@ internal Attribute[] GetAttributesFromCollection(AttributeCollection collection) | |
return attributes; | ||
} | ||
|
||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:RequiresUnreferencedCode", | ||
Justification = "The use of GetType preserves this member with RequiresUnreferencedCode, but the GetType callsites either " | ||
+ "occur in RequiresUnreferencedCode scopes, or have individually justified suppressions.")] | ||
[RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered.")] | ||
private PropertyDescriptorCollection GetProperties() | ||
{ | ||
|
@@ -419,6 +420,9 @@ private PropertyDescriptorCollection GetProperties() | |
return propertyDescriptors; | ||
} | ||
|
||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:RequiresUnreferencedCode", | ||
Justification = "The use of GetType preserves this member with RequiresUnreferencedCode, but the GetType callsites either " | ||
+ "occur in RequiresUnreferencedCode scopes, or have individually justified suppressions.")] | ||
[RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered.")] | ||
protected virtual void GetProperties(Hashtable propertyDescriptors) | ||
{ | ||
|
@@ -526,6 +530,9 @@ protected virtual void GetProperties(Hashtable propertyDescriptors) | |
} | ||
} | ||
|
||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2112:RequiresUnreferencedCode", | ||
Justification = "The use of GetType preserves this member with RequiresUnreferencedCode, but the GetType callsites either " | ||
+ "occur in RequiresUnreferencedCode scopes, or have individually justified suppressions.")] | ||
[RequiresUnreferencedCode("The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")] | ||
private PropertyDescriptorCollection GetProperties(Attribute[]? attributes) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -737,7 +737,16 @@ internal static DataTable GetSchemaTableFromDataTable(DataTable table) | |||||||||||||||
DataColumn ColumnSize = new DataColumn(SchemaTableColumn.ColumnSize, typeof(int)); | ||||||||||||||||
DataColumn NumericPrecision = new DataColumn(SchemaTableColumn.NumericPrecision, typeof(short)); | ||||||||||||||||
DataColumn NumericScale = new DataColumn(SchemaTableColumn.NumericScale, typeof(short)); | ||||||||||||||||
DataColumn DataType = new DataColumn(SchemaTableColumn.DataType, typeof(Type)); | ||||||||||||||||
DataColumn DataType = GetSystemTypeDataColumn(); | ||||||||||||||||
|
||||||||||||||||
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2111:RequiresDynamicallyAccessedMembers", | ||||||||||||||||
Justification = "The problem is Type.TypeInitializer which requires constructors on the Type instance." + | ||||||||||||||||
"In this case the Type instance is about System.Type itself, so adding an explicit dependency on the same" + | ||||||||||||||||
"annotation here.")] | ||||||||||||||||
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors, typeof(Type))] | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the trimmer treat I'm wondering if this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, it does. Good question about DynamicDependency. I only found one place where the annotation was ultimately used: runtime/src/libraries/System.Data.Common/src/System/Data/Common/SqlUDTStorage.cs Lines 45 to 51 in f9cbd72
If I didn't miss anything I think it's ok to remove. |
||||||||||||||||
static DataColumn GetSystemTypeDataColumn() => | ||||||||||||||||
new DataColumn(SchemaTableColumn.DataType, typeof(Type)); | ||||||||||||||||
|
||||||||||||||||
DataColumn ProviderType = new DataColumn(SchemaTableColumn.ProviderType, typeof(int)); | ||||||||||||||||
DataColumn IsLong = new DataColumn(SchemaTableColumn.IsLong, typeof(bool)); | ||||||||||||||||
DataColumn AllowDBNull = new DataColumn(SchemaTableColumn.AllowDBNull, typeof(bool)); | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay for extra validation. Caught a bug here...