UWP Xaml 内部错误 'WMC9999' 在模块 System.Web.dll 中找不到类型 System.Web.HttpException

UWP Xaml Internal Error 'WMC9999' Cannot find type System.Web.HttpException in module System.Web.dll

每次我尝试在 Visual Studio (2022) 中测试我的应用程序时,我都会收到此构建错误:

1>C:\Program Files (x86)\Windows Kits\bin.0.19041.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(410,5): Xaml Internal Error error WMC9999: Cannot find type System.Web.HttpException in module System.Web.dll.

this GitHub Repository

中有一个最小的可重现示例

在此先感谢您的帮助 PS: 我是 C# 的新手,只知道基础知识

The Error only Appears when i'm using the Microsoft.AspNet.WebHelpers Package

这是 AspNet nuget 包,与 UWP 平台不兼容。解码json字符串,可以使用Windows.Data.Json反序列化json字符串,这里是官方的code sample,大家可以参考

你也可以使用第三方库反序列化 json 字符串,例如 Newtonsoft。