0

以前は .NET Core 2.2 で動作していたが、3.1 にアップグレードした後に動作を停止した、非常に単純な .NET Core Web Api コードがあります。

[HttpGet]
[Route("api/news")]
public IEnumerable<SyndicationItem> GetNews(string source)
{
    var feed = SyndicationFeed.Load(XmlReader.Create(source));
    return feed.Items;
}

https://localhost:5001/api/news?source=http://feeds.bbci.co.uk/news/rss.xmlに移動して呼び出すことができます。

デバッグでは、アイテムを正常に取得できることがわかりますが、アイテムを返すこのエラーがスローされます.3.1にアップグレードした後に機能しなくなった理由と修正方法がわかりません

アドバイスをください、ありがとう!

ここに画像の説明を入力 ここに画像の説明を入力

System.NotSupportedException: 'System.ServiceModel.Syndication.SyndicationItem.AttributeExtensions' のコレクション型 'System.Collections.Generic.Dictionary`2[System.Xml.XmlQualifiedName,System.String]' はサポートされていません。System.Text.Json.JsonClassInfo.GetElementType (type propertyType、Type parentType、MemberInfo memberInfo、JsonSerializerOptions オプション) で System.Text.Json.JsonClassInfo.CreateProperty (Type definedPropertyType、Type runtimePropertyType、Type implementedPropertyType、PropertyInfo propertyInfo、Type parentClassType、JsonConverterコンバーター、JsonSerializerOptions オプション) で System.Text.Json.JsonClassInfo.AddProperty(Type propertyType、PropertyInfo propertyInfo、Type classType、JsonSerializerOptions オプション) で System.Text.Json.JsonClassInfo..ctor(Type タイプ、

4

1 に答える 1