Skip to content

Commit aaba3c2

Browse files
[main] Update dependencies from mono/linker (#55813)
* Update dependencies from https://github.com/mono/linker build 20210715.1 Microsoft.NET.ILLink.Tasks From Version 6.0.100-preview.6.21362.3 -> To Version 6.0.100-preview.6.21365.1 * Update dependencies from https://github.com/mono/linker build 20210716.2 Microsoft.NET.ILLink.Tasks From Version 6.0.100-preview.6.21362.3 -> To Version 6.0.100-preview.6.21366.2 * Suppress type hierarchy warnings Suppress type hierarchy warnings for DynamicallyAccessedMembers attribute on types that have members with RequiresUnreferencedCode (or derived types with such members). * Feedback Remove unnecessary local method * Fix typo * Update dependencies from https://github.com/mono/linker build 20210719.3 Microsoft.NET.ILLink.Tasks From Version 6.0.100-preview.6.21362.3 -> To Version 6.0.100-preview.6.21369.3 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Sven Boemer <sbomer@gmail.com>
1 parent d38a539 commit aaba3c2

File tree

8 files changed

+36
-20
lines changed

8 files changed

+36
-20
lines changed

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@
182182
<Uri>https://github.com/dotnet/runtime</Uri>
183183
<Sha>98b7ed1a3b0543a31b5a0f9069cf44cb70c9230c</Sha>
184184
</Dependency>
185-
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.6.21362.3">
185+
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.6.21369.3">
186186
<Uri>https://github.com/mono/linker</Uri>
187-
<Sha>664e78edc72dd0a48e6f55e352051b6ba61bba9a</Sha>
187+
<Sha>8d49e169d872d6225bcf73ae14ae50b002f39319</Sha>
188188
</Dependency>
189189
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.21364.1">
190190
<Uri>https://github.com/dotnet/xharness</Uri>

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
<!-- Docs -->
166166
<MicrosoftPrivateIntellisenseVersion>5.0.0-preview-20201009.2</MicrosoftPrivateIntellisenseVersion>
167167
<!-- ILLink -->
168-
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.6.21362.3</MicrosoftNETILLinkTasksVersion>
168+
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.6.21369.3</MicrosoftNETILLinkTasksVersion>
169169
<MicrosoftNETILLinkAnalyzerPackageVersion>$(MicrosoftNETILLinkTasksVersion)</MicrosoftNETILLinkAnalyzerPackageVersion>
170170
<!-- ICU -->
171171
<MicrosoftNETCoreRuntimeICUTransportVersion>6.0.0-rc.1.21366.2</MicrosoftNETCoreRuntimeICUTransportVersion>

src/libraries/System.Data.Common/src/System/Data/Common/DbConnectionStringBuilder.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
namespace System.Data.Common
1414
{
15+
// This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
16+
// 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.
17+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
18+
Justification = "The use of GetType preserves members with RequiresUnreferencedCode, but the GetType callsites either "
19+
+ "occur in RequiresUnreferencedCode scopes, or have individually justified suppressions.")]
1520
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
1621
public class DbConnectionStringBuilder : IDictionary, ICustomTypeDescriptor
1722
{
@@ -570,7 +575,7 @@ private PropertyDescriptorCollection GetProperties(Attribute[]? attributes)
570575
}
571576

572577
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
573-
Justification = "The type of component is statically known. This class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
578+
Justification = "The component type's class name is preserved because this class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
574579
string? ICustomTypeDescriptor.GetClassName()
575580
{
576581
// Below call is necessary to tell the trimmer that it should mark derived types appropriately.
@@ -579,7 +584,7 @@ private PropertyDescriptorCollection GetProperties(Attribute[]? attributes)
579584
return TypeDescriptor.GetClassName(this, true);
580585
}
581586
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
582-
Justification = "The type of component is statically known. This class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
587+
Justification = "The component type's component name is preserved because this class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
583588
string? ICustomTypeDescriptor.GetComponentName()
584589
{
585590
// Below call is necessary to tell the trimmer that it should mark derived types appropriately.
@@ -588,7 +593,7 @@ private PropertyDescriptorCollection GetProperties(Attribute[]? attributes)
588593
return TypeDescriptor.GetComponentName(this, true);
589594
}
590595
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
591-
Justification = "The type of component is statically known. This class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
596+
Justification = "The component type's attributes are preserved because this class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
592597
AttributeCollection ICustomTypeDescriptor.GetAttributes()
593598
{
594599
return TypeDescriptor.GetAttributes(this, true);
@@ -624,7 +629,7 @@ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[]? at
624629
return TypeDescriptor.GetDefaultEvent(this, true);
625630
}
626631
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
627-
Justification = "The type of component is statically known. This class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
632+
Justification = "The component type's events are preserved because this class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
628633
EventDescriptorCollection ICustomTypeDescriptor.GetEvents()
629634
{
630635
// Below call is necessary to tell the trimmer that it should mark derived types appropriately.

src/libraries/System.Data.Common/src/System/Data/DataSet.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ namespace System.Data
3030
[XmlSchemaProvider(nameof(GetDataSetSchema))]
3131
[XmlRoot(nameof(DataSet))]
3232
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
33+
// This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
34+
// 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.
35+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
36+
Justification = "CreateInstanceOfThisType's use of GetType uses only the parameterless constructor, but the annotations preserve all non-public constructors causing a warning for the serialization constructors. Those constructors won't be used here.")]
3337
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)] // needed by Clone() to preserve derived ctors
3438
public class DataSet : MarshalByValueComponent, IListSource, IXmlSerializable, ISupportInitializeNotification, ISerializable
3539
{
@@ -1093,8 +1097,6 @@ public void Clear()
10931097
}
10941098
}
10951099

1096-
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
1097-
Justification = "Only parameterless constructors are used here but since nonPublic=true, all non-public constructors are being preserved causing a warning for the serialization constructors. Those constructors won't be used here.")]
10981100
private DataSet CreateInstanceOfThisType()
10991101
{
11001102
return (DataSet)Activator.CreateInstance(GetType(), true)!;

src/libraries/System.Data.Common/src/System/Data/DataTable.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ namespace System.Data
3131
[XmlSchemaProvider(nameof(GetDataTableSchema))]
3232
[Serializable]
3333
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
34+
// This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
35+
// 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.
36+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
37+
Justification = "CreateInstance's use of GetType uses only the parameterless constructor. Warnings are about serialization related constructors.")]
3438
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
3539
public class DataTable : MarshalByValueComponent, IListSource, ISupportInitializeNotification, ISerializable, IXmlSerializable
3640
{
@@ -2307,8 +2311,6 @@ public void AcceptChanges()
23072311

23082312
// Prevent inlining so that reflection calls are not moved to caller that may be in a different assembly that may have a different grant set.
23092313
[MethodImpl(MethodImplOptions.NoInlining)]
2310-
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
2311-
Justification = "Only parameterless constructors are used here. Warning is about serialization related constructors.")]
23122314
protected virtual DataTable CreateInstance() => (DataTable)Activator.CreateInstance(GetType(), true)!;
23132315

23142316
public virtual DataTable Clone() => Clone(null);

src/libraries/System.Data.Common/src/System/Data/TypedTableBase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ namespace System.Data
1212
/// This is the generic base class for TypedDataSet
1313
/// </summary>
1414
[Serializable]
15+
// This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
16+
// 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.
17+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
18+
Justification = "DataTable.CreateInstance's use of GetType uses only the parameterless constructor. Warnings are about serialization related constructors.")]
1519
public abstract class TypedTableBase<T> : DataTable, IEnumerable<T> where T : DataRow
1620
{
1721

src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ namespace System.Diagnostics
160160
/// See the DiagnosticSourceEventSourceBridgeTest.cs for more explicit examples of using this bridge.
161161
/// </summary>
162162
[EventSource(Name = "Microsoft-Diagnostics-DiagnosticSource")]
163+
// This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
164+
// 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.
165+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
166+
Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves all members, so " +
167+
"those that are marked with RequiresUnreferencedCode will warn. " +
168+
"This method will not access any of these members and is safe to call.")]
163169
internal sealed class DiagnosticSourceEventSource : EventSource
164170
{
165171
public static DiagnosticSourceEventSource Log = new DiagnosticSourceEventSource();

src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ internal sealed class EventSourceAutoGenerateAttribute : Attribute
233233
// The EnsureDescriptorsInitialized() method might need to access EventSource and its derived type
234234
// members and the trimmer ensures that these members are preserved.
235235
[DynamicallyAccessedMembers(ManifestMemberTypes)]
236+
// This coarse suppression silences all RequiresUnreferencedCode warnings in the class.
237+
// 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.
238+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
239+
Justification = "EnsureDescriptorsInitialized's use of GetType preserves all members, so " +
240+
"those that are marked with RequiresUnreferencedCode will warn. " +
241+
"This method will not access any of these members and is safe to call.")]
236242
#endif
237243
public partial class EventSource : IDisposable
238244
{
@@ -2813,16 +2819,7 @@ private void EnsureDescriptorsInitialized()
28132819
{
28142820
// get the metadata via reflection.
28152821
Debug.Assert(m_rawManifest == null);
2816-
#if !ES_BUILD_STANDALONE
2817-
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
2818-
Justification = "Based on the annotation on EventSource class, Trimmer will see from its analysis members " +
2819-
"that are marked with RequiresUnreferencedCode and will warn." +
2820-
"This method will not access any of these members and is safe to call.")]
2821-
byte[]? GetCreateManifestAndDescriptorsViaLocalMethod(string name) => CreateManifestAndDescriptors(this.GetType(), name, this);
2822-
m_rawManifest = GetCreateManifestAndDescriptorsViaLocalMethod(Name);
2823-
#else
28242822
m_rawManifest = CreateManifestAndDescriptors(this.GetType(), Name, this);
2825-
#endif
28262823
Debug.Assert(m_eventData != null);
28272824

28282825
// TODO Enforce singleton pattern

0 commit comments

Comments
 (0)