我们有一个用.NET Core 2.2编写的相当大的项目,已更新为Abp 4.10.1,我们从Abp的模板开始。
最近我在项目中添加了Roslyn analyzers,现在在L method的每个实例上都有数百条警告。
示例:
case AbploginResultType.InvalidPassword:
return new UserFriendlyException(L("LoginFailed"),L("InvalidusernameOrPassword"));
给我们:
警告CA1304'AbpServiceBase.L(string)'的行为可能会根据当前用户的区域设置而有所不同。将对AbploginResultTypeHelper.CreateExceptionForFailedLoginAttempt(AbploginResultType,string,string)的调用替换为对AbpServiceBase.L(string,CultureInfo)的调用。
据我从文档中了解到,L方法旨在简化本地化调用和already considers culture,但是向每个调用添加CultureInfo
信息以满足Roslyn分析仪的要求。
我不想在项目级别抑制此警告,我们认为其他选项似乎很耗时。
那么,有没有一种有效的方法来解决这个问题?