Description
Description
When publishing an app with System.ServiceModel.Syndication added and used inside it (loading a simple feed is enough) it will trigger the IL2067 trim warning.
Reproduction Steps
using System.ServiceModel.Syndication;
using System.Xml;
namespace TestApp;
public sealed class RssFeedService
{
public void GetFeeds()
{
using XmlReader reader = XmlReader.Create("someRssFeed");
SyndicationFeed feed = SyndicationFeed.Load(reader);
}
}
Expected behavior
No Trim Warning visible when publishing the app.
Actual behavior
ILC: Trim analysis warning IL2067:
System.ServiceModel.Syndication.SyndicationFeedFormatter.CreateFeedInstance(Type): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in call to 'System.Activator.CreateInstance(Type)'.
The parameter 'feedType' of method 'System.ServiceModel.Syndication.SyndicationFeedFormatter.CreateFeedInstance(Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
Regression?
No response
Known Workarounds
No response
Configuration
.NET Version: 9.0.3 with SDK 9.0.201
OS: Windows 11 Pro 26120.3585
Arch: x64
Only occurs when trimming is active (aka published with NAOT)
Other information
Possibly related to #75480