Skip to content
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 #55813

Merged
merged 6 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>98b7ed1a3b0543a31b5a0f9069cf44cb70c9230c</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.6.21362.3">
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.6.21369.3">
<Uri>https://github.com/mono/linker</Uri>
<Sha>664e78edc72dd0a48e6f55e352051b6ba61bba9a</Sha>
<Sha>8d49e169d872d6225bcf73ae14ae50b002f39319</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.21364.1">
<Uri>https://github.com/dotnet/xharness</Uri>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>5.0.0-preview-20201009.2</MicrosoftPrivateIntellisenseVersion>
<!-- ILLink -->
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.6.21362.3</MicrosoftNETILLinkTasksVersion>
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.6.21369.3</MicrosoftNETILLinkTasksVersion>
<MicrosoftNETILLinkAnalyzerPackageVersion>$(MicrosoftNETILLinkTasksVersion)</MicrosoftNETILLinkAnalyzerPackageVersion>
<!-- ICU -->
<MicrosoftNETCoreRuntimeICUTransportVersion>6.0.0-preview.7.21363.1</MicrosoftNETCoreRuntimeICUTransportVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

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 "
+ "occur in RequiresUnreferencedCode scopes, or have individually justified suppressions.")]
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
public class DbConnectionStringBuilder : IDictionary, ICustomTypeDescriptor
{
Expand Down Expand Up @@ -570,7 +575,7 @@ private PropertyDescriptorCollection GetProperties(Attribute[]? attributes)
}

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "The type of component is statically known. This class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
Justification = "The component type's class name is preserved because this class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
string? ICustomTypeDescriptor.GetClassName()
{
// Below call is necessary to tell the trimmer that it should mark derived types appropriately.
Expand All @@ -579,7 +584,7 @@ private PropertyDescriptorCollection GetProperties(Attribute[]? attributes)
return TypeDescriptor.GetClassName(this, true);
}
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "The type of component is statically known. This class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
Justification = "The component type's component name is preserved because this class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
string? ICustomTypeDescriptor.GetComponentName()
{
// Below call is necessary to tell the trimmer that it should mark derived types appropriately.
Expand All @@ -588,7 +593,7 @@ private PropertyDescriptorCollection GetProperties(Attribute[]? attributes)
return TypeDescriptor.GetComponentName(this, true);
}
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "The type of component is statically known. This class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
Justification = "The component type's attributes are preserved because this class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
AttributeCollection ICustomTypeDescriptor.GetAttributes()
{
return TypeDescriptor.GetAttributes(this, true);
Expand Down Expand Up @@ -624,7 +629,7 @@ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[]? at
return TypeDescriptor.GetDefaultEvent(this, true);
}
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "The type of component is statically known. This class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
Justification = "The component type's events are preserved because this class is marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]")]
EventDescriptorCollection ICustomTypeDescriptor.GetEvents()
{
// Below call is necessary to tell the trimmer that it should mark derived types appropriately.
Expand Down
6 changes: 4 additions & 2 deletions src/libraries/System.Data.Common/src/System/Data/DataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ namespace System.Data
[XmlSchemaProvider(nameof(GetDataSetSchema))]
[XmlRoot(nameof(DataSet))]
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
// 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 = "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.")]
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)] // needed by Clone() to preserve derived ctors
public class DataSet : MarshalByValueComponent, IListSource, IXmlSerializable, ISupportInitializeNotification, ISerializable
{
Expand Down Expand Up @@ -1093,8 +1097,6 @@ public void Clear()
}
}

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
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.")]
private DataSet CreateInstanceOfThisType()
{
return (DataSet)Activator.CreateInstance(GetType(), true)!;
Expand Down
6 changes: 4 additions & 2 deletions src/libraries/System.Data.Common/src/System/Data/DataTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace System.Data
[XmlSchemaProvider(nameof(GetDataTableSchema))]
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
// 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 = "CreateInstance's use of GetType uses only the parameterless constructor. Warnings are about serialization related constructors.")]
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
public class DataTable : MarshalByValueComponent, IListSource, ISupportInitializeNotification, ISerializable, IXmlSerializable
{
Expand Down Expand Up @@ -2307,8 +2311,6 @@ public void AcceptChanges()

// 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.
[MethodImpl(MethodImplOptions.NoInlining)]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "Only parameterless constructors are used here. Warning is about serialization related constructors.")]
protected virtual DataTable CreateInstance() => (DataTable)Activator.CreateInstance(GetType(), true)!;

public virtual DataTable Clone() => Clone(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ namespace System.Data
/// This is the generic base class for TypedDataSet
/// </summary>
[Serializable]
// 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 = "DataTable.CreateInstance's use of GetType uses only the parameterless constructor. Warnings are about serialization related constructors.")]
public abstract class TypedTableBase<T> : DataTable, IEnumerable<T> where T : DataRow
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ namespace System.Diagnostics
/// See the DiagnosticSourceEventSourceBridgeTest.cs for more explicit examples of using this bridge.
/// </summary>
[EventSource(Name = "Microsoft-Diagnostics-DiagnosticSource")]
// 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 = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves all members, so " +
"those that are marked with RequiresUnreferencedCode will warn. " +
"This method will not access any of these members and is safe to call.")]
internal sealed class DiagnosticSourceEventSource : EventSource
{
public static DiagnosticSourceEventSource Log = new DiagnosticSourceEventSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ internal sealed class EventSourceAutoGenerateAttribute : Attribute
// The EnsureDescriptorsInitialized() method might need to access EventSource and its derived type
// members and the trimmer ensures that these members are preserved.
[DynamicallyAccessedMembers(ManifestMemberTypes)]
// 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 = "EnsureDescriptorsInitialized's use of GetType preserves all members, so " +
"those that are marked with RequiresUnreferencedCode will warn. " +
"This method will not access any of these members and is safe to call.")]
#endif
public partial class EventSource : IDisposable
{
Expand Down Expand Up @@ -2813,16 +2819,7 @@ private void EnsureDescriptorsInitialized()
{
// get the metadata via reflection.
Debug.Assert(m_rawManifest == null);
#if !ES_BUILD_STANDALONE
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
eerhardt marked this conversation as resolved.
Show resolved Hide resolved
Justification = "Based on the annotation on EventSource class, Trimmer will see from its analysis members " +
"that are marked with RequiresUnreferencedCode and will warn." +
"This method will not access any of these members and is safe to call.")]
byte[]? GetCreateManifestAndDescriptorsViaLocalMethod(string name) => CreateManifestAndDescriptors(this.GetType(), name, this);
m_rawManifest = GetCreateManifestAndDescriptorsViaLocalMethod(Name);
#else
m_rawManifest = CreateManifestAndDescriptors(this.GetType(), Name, this);
#endif
Debug.Assert(m_eventData != null);

// TODO Enforce singleton pattern
Expand Down