Skip to content
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
ILLink annotation related to ISerializable and IBindingListView in Sy…
…stem.Data.Common
  • Loading branch information
krwq committed Jul 9, 2021
commit ae8963843ac544190750e149faf3600e89cd090c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ public partial interface IBindingList : System.Collections.ICollection, System.C
}
public partial interface IBindingListView : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ComponentModel.IBindingList
{
string? Filter { get; set; }
string? Filter { get; [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Members of types used in the filter expression might be trimmed.")] set; }
System.ComponentModel.ListSortDescriptionCollection SortDescriptions { get; }
bool SupportsAdvancedSorting { get; }
bool SupportsFiltering { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface IBindingListView : IBindingList
{
void ApplySort(ListSortDescriptionCollection sorts);

string? Filter { get; set; }
string? Filter { get; [RequiresUnreferencedCode("Members of types used in the filter expression might be trimmed.")] set; }

ListSortDescriptionCollection SortDescriptions { get; }

Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Data.Common/ref/System.Data.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ public DataView(System.Data.DataTable table, string? RowFilter, string? Sort, Sy
bool System.ComponentModel.IBindingList.SupportsChangeNotification { get { throw null; } }
bool System.ComponentModel.IBindingList.SupportsSearching { get { throw null; } }
bool System.ComponentModel.IBindingList.SupportsSorting { get { throw null; } }
string? System.ComponentModel.IBindingListView.Filter { get { throw null; } set { } }
string? System.ComponentModel.IBindingListView.Filter { get { throw null; } [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Members of types used in the filter expression might be trimmed.")] set { } }
System.ComponentModel.ListSortDescriptionCollection System.ComponentModel.IBindingListView.SortDescriptions { get { throw null; } }
bool System.ComponentModel.IBindingListView.SupportsAdvancedSorting { get { throw null; } }
bool System.ComponentModel.IBindingListView.SupportsFiltering { get { throw null; } }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<linker>
<assembly fullname="System.Data.Common, PublicKeyToken=b03f5f7f11d50a3a">
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:System.Data.DataSet.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
Expand All @@ -25,12 +19,6 @@
<property name="Scope">member</property>
<property name="Target">M:System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:System.Data.DataTable.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
Expand All @@ -49,11 +37,5 @@
<property name="Scope">member</property>
<property name="Target">M:System.Data.DataTable.WriteXmlCore(System.Xml.XmlWriter)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:System.Data.DataView.System.ComponentModel.IBindingListView.set_Filter(System.String)</property>
</attribute>
</assembly>
</linker>
2 changes: 2 additions & 0 deletions src/libraries/System.Data.Common/src/System/Data/DataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ protected DataSet(SerializationInfo info, StreamingContext context, bool Constru
DeserializeDataSet(info, context, remotingFormat, schemaSerializationMode);
}

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "Binary serialization is unsafe in general and is planned to be obsoleted. We do not want to mark interface or ctors of this class as unsafe as that would show many unnecessary warnings elsewhere.")]
Copy link
Member

Choose a reason for hiding this comment

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

@vitek-karas @MichalStrehovsky @marek-safar - are you OK with these suppressions? According to https://github.com/dotnet/designs/blob/main/accepted/2020/better-obsoletion/binaryformatter-obsoletion.md#entirety-of-binaryformatter-type-obsolete-as-warning, these GetObjectData methods are scheduled for obsoletion in .NET 7, along with ISerializable. So going through the work of marking ISerializable.GetObjectData as [RUC] just doesn't seem worth it right now.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Spoke with Eric offline about this. Just to clarify: ISerializable is distinct from BinaryFormatter, though the two are commonly used together. Our primary focus is on removing BinaryFormatter from the ecosystem. That doc also talks about removing ISerializable from the ecosystem, but there's less immediate urgency around this, so the timelines might not match up 100%.

Regardless, I think suppressing this is the right move for now. 👍

public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
SerializationFormat remotingFormat = RemotingFormat;
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/System.Data.Common/src/System/Data/DataTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ protected DataTable(SerializationInfo info, StreamingContext context) : this()
DeserializeDataTable(info, context, isSingleTable, remotingFormat);
}

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
Justification = "Binary serialization is unsafe in general and is planned to be obsoleted. We do not want to mark interface or ctors of this class as unsafe as that would show many unnecessary warnings elsewhere.")]
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
SerializationFormat remotingFormat = RemotingFormat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,7 @@ void IBindingListView.RemoveFilter()
string? IBindingListView.Filter
{
get { return RowFilter; }
[RequiresUnreferencedCode(Select.RequiresUnreferencedCodeMessage)]
set { RowFilter = value; }
}

Expand Down