【问题标题】:NDepend for HasAttribute ("System.CodeDom.Compiler.GeneratedCodeAttribute".AllowNoMatch())HasAttribute 的 NDepend ("System.CodeDom.Compiler.GeneratedCodeAttribute".AllowNoMatch())
【发布时间】:2013-07-08 17:59:57
【问题描述】:

我有一个修改后的自定义规则,如下所示,并且“System.CodeDom.Compiler.GeneratedCodeAttribute”的查询语法错误不是有效的类型名称。 (对于我们的其他自定义属性,我也遇到了同样的错误)。 我尝试使用 AllowNoMatch() 来避免语法错误,但它对我的结果没有影响。

另一个属性“System.Diagnostics.DebuggerNonUserCodeAttribute”工作得很好。

我有什么想念的吗?

================================================ ===============

// <Name>Methods too big (LOC)</Name>
warnif count > 0 from m in JustMyCode.Methods where 
   m.NbLinesOfCode > 30 
   && !m.ParentType.HasAttribute( "System.Diagnostics.DebuggerNonUserCodeAttribute" )
   && !m.ParentType.HasAttribute( "System.CodeDom.Compiler.GeneratedCodeAttribute" )

   orderby m.NbLinesOfCode descending,
       m.NbILInstructions descending
select new { m, m.NbLinesOfCode, m.NbILInstructions }

// Methods where NbLinesOfCode > 30 or NbILInstructions > 200
// are extremely complex and should be split in smaller methods.
// See the definition of the NbLinesOfCode metric here 
// http://www.ndepend.com/Metrics.aspx#NbLinesOfCode

【问题讨论】:

  • 您能否检查一下您的应用程序中是否确实使用了“System.CodeDom.Compiler.GeneratedCodeAttribute”,并且在NDepend类浏览器中该属性类型是否出现在第三方程序集System下?

标签: ndepend


【解决方案1】:

我发现问题在于包含第三方程序集文件(在本例中为 System.dll)存在问题,其中我有两个冲突的 System.dll 文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-22
    • 1970-01-01
    • 2021-08-08
    • 2012-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多