2

刚刚从 nuget 包中安装了 Postsharp 2.1,然后安装了 Phil Haack 的 NullGuard 包。

当我在类或方法级别添加 [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) 这可能是需要担心的事情。

非常感激任何的帮助。

干杯!

托德。

4

3 回答 3

2

这是因为您使用的是 PostSharp 的免费版本,它不包含方面优化功能。请参阅 PostSharp.net 上的功能比较

https://github.com/Haacked/NullGuard/issues/3

于 2013-05-02T14:09:11.330 回答
1

有点晚了,但我可能已经找到了解决方案。我在引发警告的项目文件中添加了以下标记:

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

这解决了我的问题。

于 2013-11-18T15:47:50.970 回答
0

这是因为 PostSharp 尚未处理该 NuGet 包中包含的库。

于 2013-05-06T10:11:33.017 回答