UWP编译互操作代码时为何生成System.Nullable<string>引发CS0453错误?
UWP Release构建生成
Nullable<string>引发CS0453编译错误 我有一个UWP项目,在Release配置下构建解决方案时,出现以下编译错误:
obj\x64\Release\ilc\intermediate\BelledonneCommunications.Linphone.App.McgInterop\Data.g.cs(110561,148): error CS0453 : The type 'string' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or meth od 'Nullable<T>' obj\x64\Release\ilc\intermediate\BelledonneCommunications.Linphone.App.McgInterop\Data.g.cs(110562,148): error CS0453 : The type 'string' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or meth od 'Nullable<T>' obj\x64\Release\ilc\intermediate\BelledonneCommunications.Linphone.App.McgInterop\ImplTypes.g.cs(235776,50): error CS 0453: The type 'string' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'Nullable<T>' obj\x64\Release\ilc\intermediate\BelledonneCommunications.Linphone.App.McgInterop\ImplTypes.g.cs(235837,41): error CS 0453: The type 'string' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'Nullable<T>'
我的问题是:UWP为何会在ImplTypes.g.cs中生成System.Nullable<string>?
2022年8月12日更新
我在GitHub Issue中记录了排查进展:发现问题源于当前Linphone项目引用了BSN.Resa.Vns.Commons和BSN.Resa.Mci.CallCenter.AgentApp.Data两个项目,但暂不清楚引用这两个项目会导致McgInterop生成Nullable<string>的原因。
2022年8月25日更新
已定位问题根源:来自最新版本的StackExchange.Redis包。我已在对应项目仓库中提交问题描述,相关维护人员已启动调查工作。
内容的提问来源于stack exchange,提问作者sorosh_sabz
相关产品推荐
相关产品推荐

