Skip to content

Annotate System.ServiceModel.Syndication for trimming and AOT #114028

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
<Compile Include="System.ServiceModel.Syndication.netcoreapp.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMembersAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\RequiresUnreferencedCodeAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\RequiresDynamicCodeAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.ServiceModel" />
</ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
<EnableAOTAnalyzer>false</EnableAOTAnalyzer>
<IncludePlatformAttributes>true</IncludePlatformAttributes>
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
<IsPackable>true</IsPackable>
Expand Down Expand Up @@ -64,6 +63,14 @@
<Compile Include="System\ServiceModel\XmlBuffer.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMembersAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\RequiresUnreferencedCodeAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\RequiresDynamicCodeAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.ServiceModel" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Atom10FeedFormatter() : this(typeof(SyndicationFeed))
{
}

public Atom10FeedFormatter(Type feedTypeToCreate) : base()
public Atom10FeedFormatter([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type feedTypeToCreate) : base()
{
if (feedTypeToCreate is null)
{
Expand Down Expand Up @@ -69,6 +69,7 @@ internal override TryParseDateTimeCallback GetDefaultDateTimeParser()

public override string Version => SyndicationVersions.Atom10;

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
protected Type FeedType { get; }

public override bool CanRead(XmlReader reader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public Atom10ItemFormatter() : this(typeof(SyndicationItem))
{
}

public Atom10ItemFormatter(Type itemTypeToCreate) : base()
public Atom10ItemFormatter([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type itemTypeToCreate) : base()
{
if (itemTypeToCreate is null)
{
Expand Down Expand Up @@ -61,6 +61,7 @@ public bool PreserveElementExtensions

public override string Version => SyndicationVersions.Atom10;

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
protected Type ItemType { get; }

public override bool CanRead(XmlReader reader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ namespace System.ServiceModel.Syndication
[XmlRoot(ElementName = App10Constants.Categories, Namespace = App10Constants.Namespace)]
public class AtomPub10CategoriesDocumentFormatter : CategoriesDocumentFormatter, IXmlSerializable
{
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
private readonly Type _inlineDocumentType;
private readonly int _maxExtensionSize;
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
private readonly Type _referencedDocumentType;

public AtomPub10CategoriesDocumentFormatter() : this(typeof(InlineCategoriesDocument), typeof(ReferencedCategoriesDocument))
{
}

public AtomPub10CategoriesDocumentFormatter(Type inlineDocumentType, Type referencedDocumentType) : base()
public AtomPub10CategoriesDocumentFormatter(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type inlineDocumentType,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type referencedDocumentType) : base()
{
if (inlineDocumentType == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ namespace System.ServiceModel.Syndication
[XmlRoot(ElementName = App10Constants.Service, Namespace = App10Constants.Namespace)]
public class AtomPub10ServiceDocumentFormatter : ServiceDocumentFormatter, IXmlSerializable
{
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
private readonly Type _documentType;
private readonly int _maxExtensionSize;

public AtomPub10ServiceDocumentFormatter() : this(typeof(ServiceDocument))
{
}

public AtomPub10ServiceDocumentFormatter(Type documentTypeToCreate) : base()
public AtomPub10ServiceDocumentFormatter([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type documentTypeToCreate) : base()
{
if (documentTypeToCreate is null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Xml;

namespace System.ServiceModel.Syndication
{
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public abstract class CategoriesDocument : IExtensibleSyndicationObject
{
private ExtensibleSyndicationObject _extensions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Rss20FeedFormatter() : this(typeof(SyndicationFeed))
{
}

public Rss20FeedFormatter(Type feedTypeToCreate) : base()
public Rss20FeedFormatter([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type feedTypeToCreate) : base()
{
if (feedTypeToCreate is null)
{
Expand Down Expand Up @@ -69,6 +69,7 @@ public Rss20FeedFormatter(SyndicationFeed feedToWrite, bool serializeExtensionsA

public override string Version => SyndicationVersions.Rss20;

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
protected Type FeedType { get; }

public override bool CanRead(XmlReader reader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public Rss20ItemFormatter() : this(typeof(SyndicationItem))
{
}

public Rss20ItemFormatter(Type itemTypeToCreate) : base()
public Rss20ItemFormatter([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type itemTypeToCreate) : base()
{
if (itemTypeToCreate is null)
{
Expand Down Expand Up @@ -84,6 +84,7 @@ public bool SerializeExtensionsAsAtom

public override string Version => SyndicationVersions.Rss20;

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
protected Type ItemType { get; }

public override bool CanRead(XmlReader reader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Xml;

namespace System.ServiceModel.Syndication
{
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public class ServiceDocument : IExtensibleSyndicationObject
{
private ExtensibleSyndicationObject _extensions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;
using System.Xml;
using System.Xml.Serialization;
Expand Down Expand Up @@ -45,11 +46,13 @@ public static TextSyndicationContent CreateXhtmlContent(string content)
return new TextSyndicationContent(content, TextSyndicationContentKind.XHtml);
}

[RequiresUnreferencedCode(SyndicationFeedFormatter.RequiresUnreferencedCodeWarning)]
public static XmlSyndicationContent CreateXmlContent(object dataContractObject)
{
return new XmlSyndicationContent(Atom10Constants.XmlMediaType, dataContractObject, (DataContractSerializer)null);
}

[RequiresUnreferencedCode(SyndicationFeedFormatter.RequiresUnreferencedCodeWarning)]
public static XmlSyndicationContent CreateXmlContent(object dataContractObject, XmlObjectSerializer dataContractSerializer)
{
return new XmlSyndicationContent(Atom10Constants.XmlMediaType, dataContractObject, dataContractSerializer);
Expand All @@ -60,6 +63,8 @@ public static XmlSyndicationContent CreateXmlContent(XmlReader xmlReader)
return new XmlSyndicationContent(xmlReader);
}

[RequiresUnreferencedCode(SyndicationFeedFormatter.RequiresUnreferencedCodeWarning)]
[RequiresDynamicCode(SyndicationFeedFormatter.RequiresDynamicCodeWarning)]
public static XmlSyndicationContent CreateXmlContent(object xmlSerializerObject, XmlSerializer serializer)
{
return new XmlSyndicationContent(Atom10Constants.XmlMediaType, xmlSerializerObject, serializer);
Expand Down
Loading
Loading