jjzjj

postsharp

全部标签

c# - 确定对不正确的 .NET Framework 版本的间接依赖的来源

我想知道如何确定此构建错误的来源;Warning4Theprimaryreference"MyNamespace.MyProject"couldnotberesolvedbecauseithasanindirectdependencyonthe.NETFrameworkassembly"System.Xml,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"whichhasahigherversion"4.0.0.0"thantheversion"2.0.0.0"inthecurrenttargetframe

c# - 在不跳过 PostSharp 的情况下在构建时安静下来 PostSharp 警告

根据推荐的PostSharp最佳实践,我在我的所有项目中都包含了PostSharp。但是,我在其中一些程序集中没有任何方面或其他转换;他们只是引用了其他确实有使用方面的项目。在构建时,我收到以下警告:Themodule'xxxxxxx.dll'doesnotcontainanyaspectorothertransformation.Forimprovedbuild-timeperformance,considerdisablingPostSharpforthismodulebysettingthecompilationsymbol(akaconstant)'SkipPostSharp'

c# - 如何向 PostSharp 属性添加参数?

我有一个简单的PostSharp日志属性:[Serializable]publicclassMethodLoggingAttribute:OnMethodBoundaryAspect{privateILog_logger;publicoverridevoidOnEntry(MethodExecutionEventArgseventArgs){_logger=LogManager.GetLogger(eventArgs.Method.DeclaringType.ToString());_logger.DebugFormat("Entered{0}",eventArgs.Method.Na

当文档更改时,在postsharp [命令]上触发“ canecute”?

我目前正在迁移一个项目以删除大量样板代码,其中大部分的运行非常顺利,但是我对如何强制命令进行重新检查感到困惑CanExecute。我希望PostSharp会像检查依赖项一样检查命令,这是一个简约的样本[NotifyPropertyChanged]publicclassMyWindowViewModel{///AnythingboundtothisrefreshesjustfineasexpectedpublicObservableCollectionDocuments=newObservableCollection();[Command]publicICommandAddDocumentCom

c# - PostSharp 和 Visual Studio 代码覆盖率

我最近开始在我的一些项目中使用PostSharp,并注意到一个不幸的副作用-所有使用它的项目的代码覆盖率都显着下降。我猜发生这种情况的原因是分析器看到了PostSharp代码并且其中很多代码没有经过测试(即用于通用异常处理和日志记录的样板代码)。我显然可以为每个使用方面的方法编写单元测试,但老实说,这感觉像是在浪费时间。有没有人对这种事情有任何经验? 最佳答案 您使用什么代码覆盖工具?在PartCover中,您可以忽略一些类或命名空间,如MyProgram.PostSharp.*,以接收正确的数字。

c# - PostSharp 和 Visual Studio 代码覆盖率

我最近开始在我的一些项目中使用PostSharp,并注意到一个不幸的副作用-所有使用它的项目的代码覆盖率都显着下降。我猜发生这种情况的原因是分析器看到了PostSharp代码并且其中很多代码没有经过测试(即用于通用异常处理和日志记录的样板代码)。我显然可以为每个使用方面的方法编写单元测试,但老实说,这感觉像是在浪费时间。有没有人对这种事情有任何经验? 最佳答案 您使用什么代码覆盖工具?在PartCover中,您可以忽略一些类或命名空间,如MyProgram.PostSharp.*,以接收正确的数字。
12