2013-07-08 35 views
1

我有一個修改後的自定義規則,如下所示,並且我得到了「System.CodeDom.Compiler.GeneratedCodeAttribute」的查詢語法錯誤。一個有效的類型名稱。 (我也有我們的其他自定義屬性相同的錯誤)。 我嘗試使用AllowNoMatch()來避免語法錯誤,但它對我的結果沒有任何影響。NDepend HasAttribute(「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 
+0

您是否可以檢查「System.CodeDom.Compiler.GeneratedCodeAttribute」是否確實在您的應用程序中使用,並且如果在NDepend類瀏覽器中,此屬性類型顯示在第三方裝配系統下? –

回答

0

我發現這個問題是有一個問題,包括第三方組件文件(System.dll中在這種情況下),我有兩個衝突System.dll文件。