首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UWP在System.Nullable<string>上编译互操作代码错误

UWP在System.Nullable<string>上编译互操作代码错误
EN

Stack Overflow用户
提问于 2022-08-11 15:54:45
回答 1查看 42关注 0票数 -1

我有一个UWP 项目

当我想在发行版配置中构建这个解决方案时,我得到了以下错误

代码语言:javascript
复制
  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在System.Nullable<string>?中生成

更新8/12/2022:

正如我在https://github.com/BSVN/linphone-windows10/issues/18#issue-1335892790中所说的,我发现问题是从引用项目到BSN.Resa.Vns.Commons和在Linphone项目中的BSN.Resa.Mci.CallCenter.AgentApp.Data,但是我不知道为什么引用这些项目会在McgInerop__中生成System.Nullable<string>

更新8/25/2022:

我发现我的问题来自最新的StackExchange.Redis包,我在https://github.com/StackExchange/StackExchange.Redis/issues/2212上创建了问题并描述了我的问题,所以https://github.com/tommcdonhttps://github.com/StackExchange/StackExchange.Redis/issues/2212#issuecomment-1220221475中对这个问题进行了调查

EN

回答 1

Stack Overflow用户

发布于 2022-08-11 18:22:32

类型'string‘必须是非空值类型,才能将其用作泛型类型或方法'Nullable’中的参数'T‘。

尝试将传入的字符串定义更改为可空字段,如string?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73323646

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档