2013-05-01 15 views
2

剛剛從nuget包安裝了Postsharp 2.1,然後安裝了Phil Haack的NullGuard軟件包。編譯器警告「Missing optimization information」OnEntry和OnExit with NullGuard.PostSharp

正如我在任一類或方法級別添加[EnsureNonNullAspect]方面我立刻得到以下編譯器警告:

Warning 1 Missing optimization information on method' 
      NullGuard.PostSharp.EnsureNonNullAspect.OnEntry(
      PostSharp.Aspects.MethodExecutionArgs)'. 
      This information is computed automatically by PostSharp. 
      Make sure that assembly NullGuard.PostSharp is processed by PostSharp 
Warning 2 Missing optimization information on method 
      'NullGuard.PostSharp.EnsureNonNullAspect.OnExit(
      PostSharp.Aspects.MethodExecutionArgs)'. 
      This information is computed automatically by PostSharp. 
      Make sure that assembly NullGuard.PostSharp is processed by PostSharp 

這可能是因爲這是沒有什麼可擔心的,但:

a)我不喜歡編譯器警告,我無法在Google的任何地方找到答案。 b)它可能是一些值得擔心的事情。

任何幫助將不勝感激。

乾杯!

Tod。

+1

用響應更新了你的github問題:https://github.com/Haacked/NullGuard/issues/3 – 2013-05-01 13:45:38

+1

所以我只是從GitHub中取出最新的源代碼,並且仍然收到相同的警告(僅適用於OnEntry和你預測的OnSuccess)。 – 2013-05-02 00:18:26

回答

0

這是因爲包含在NuGet包沒有被PostSharp處理的庫。

1

有點晚了,但我可能找到了解決方案。我添加了以下標籤在被提高的警告項目文件:

<PropertyGroup> 
    <UsePostSharp>true</UsePostSharp> 
</PropertyGroup> 

這解決了這個問題對我來說。