为什么 ReSharper and/or Microsoft Code Analysis 不抱怨这个非本地化字符串?
Why isn't ReSharper and/or Microsoft Code Analysis complaining about this nonlocalized string?
我已将日志消息添加到我的 C# 代码中:
Log.Info("Why no complaint about this nonlocalized string?");
如其所示,我没有收到 ReSharper 或 Microsoft Code Analysis 关于我使用非本地化字符串这一事实的投诉。我想我已经设置好抱怨本地化问题:
对于 ReSharper,我将项目的 "Localizable" 设置为 "Yes",并将 "Localizable Inspector" 设置为 "Pessimistic"。
对于 Microsoft 代码分析,我将项目的规则设置为 "Microsoft All Rules"。
我肯定收到过至少其中一位的投诉,而且我认为他们两人在过去都曾使用(我认为)这些相同的设置来处理类似的事情。我错过了什么吗?
“属性”窗格中项目 "Localizable" 设置的小描述说 "By default, ReSharper only highlights localizable items if one or more resource files are available in the project." 我将 "Localizable" 设置为 "Yes",而不是 "Default",所以似乎这不应该适用于我(而且我很确定它在过去的类似情况下不适用于我),但这是一个全新的项目,还没有资源文件,所以我决定添加一个只是为了看看它是否有帮助。它没有 - 问题仍然存在。
我正在使用 VS2012 和 ReSharper Ultimate 10.0.2。我过去曾使用 products/versions 的这种精确组合,并在这些方面取得了成功。
更新: 好像跟Log.Info有关系? ReSharper 将抱怨以下任一行:
var blah = "Why no complaint about this nonlocalized string?";
System.Console.WriteLine("Why no complaint about this nonlocalized string?");
但它不会抱怨这个:
Log.Info("Why no complaint about this nonlocalized string?");
有趣的是,它会抱怨这个:
Log.Info("Why no complaint about this nonlocalized string? {0}", blah);
"Log"是一个NLog.Logger,在class中定义如下:
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
Log.Info
有一个 [Localizable(false)]
属性:
public void Info([Localizable(false)] string message)
我已将日志消息添加到我的 C# 代码中:
Log.Info("Why no complaint about this nonlocalized string?");
如其所示,我没有收到 ReSharper 或 Microsoft Code Analysis 关于我使用非本地化字符串这一事实的投诉。我想我已经设置好抱怨本地化问题:
对于 ReSharper,我将项目的 "Localizable" 设置为 "Yes",并将 "Localizable Inspector" 设置为 "Pessimistic"。
对于 Microsoft 代码分析,我将项目的规则设置为 "Microsoft All Rules"。
我肯定收到过至少其中一位的投诉,而且我认为他们两人在过去都曾使用(我认为)这些相同的设置来处理类似的事情。我错过了什么吗?
“属性”窗格中项目 "Localizable" 设置的小描述说 "By default, ReSharper only highlights localizable items if one or more resource files are available in the project." 我将 "Localizable" 设置为 "Yes",而不是 "Default",所以似乎这不应该适用于我(而且我很确定它在过去的类似情况下不适用于我),但这是一个全新的项目,还没有资源文件,所以我决定添加一个只是为了看看它是否有帮助。它没有 - 问题仍然存在。
我正在使用 VS2012 和 ReSharper Ultimate 10.0.2。我过去曾使用 products/versions 的这种精确组合,并在这些方面取得了成功。
更新: 好像跟Log.Info有关系? ReSharper 将抱怨以下任一行:
var blah = "Why no complaint about this nonlocalized string?";
System.Console.WriteLine("Why no complaint about this nonlocalized string?");
但它不会抱怨这个:
Log.Info("Why no complaint about this nonlocalized string?");
有趣的是,它会抱怨这个:
Log.Info("Why no complaint about this nonlocalized string? {0}", blah);
"Log"是一个NLog.Logger,在class中定义如下:
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
Log.Info
有一个 [Localizable(false)]
属性:
public void Info([Localizable(false)] string message)