PostSharp 日志记录智能标记不可用

PostSharp logging smart tag unavailable

我刚刚开始使用 PostSharp。出于某种原因,我没有看到日志记录智能标记 - 我唯一的选择是添加 "architecture constraints".

此外,我没有在私有方法上看到智能标记。

可能是什么问题?

更新

诊断输出:

devenv.exe Information: 0 : OnBeforeDocumentWindowShow
devenv.exe Information: 0 : Smart tag: restart quiet period.
devenv.exe Information: 0 : Ignoring this tick because it's too early.
devenv.exe Information: 0 : Smart tag: OnTick
devenv.exe Information: 0 : AddAspectsSmartTagger.UpdateCurrentCodeElement
devenv.exe Information: 0 : AddAspectsSmartTagger.GetTag
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.ComponentInternalConstraintTypeAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.InternalImplementConstraintAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.AggregatableAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.ChildAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.DisposableAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.EditableObjectAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.ParentAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.RecordableAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.ReferenceAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.CreditCardQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.EmailAddressQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.GreaterThanQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.LessThanQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.NotEmptyQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.NotNullQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.PhoneQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.PositiveQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.RangeQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.RequiredQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.StrictlyPositiveQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.UrlQuickAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Threading.ApplyThreadingModelAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Threading.DeadlockDetectionAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.AddConstraintAction.
devenv.exe Information: 0 :   eligible.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.ComponentInternalConstraintAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.InternalConstraintAction.
devenv.exe Information: 0 :   eligible.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.ProtectedConstraintAction.
devenv.exe Information: 0 :   eligible.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Threading.UpgradeableReaderLockAction.
devenv.exe Information: 0 :   not eligible because of PostSharp.VisualStudio.Services.QuickAction.Filters.PackageCompatibilityFilter does not match.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Diagnostics.LogAction.
devenv.exe Information: 0 :   not eligible because of PostSharp.VisualStudio.Services.QuickAction.Filters.PackageCompatibilityFilter does not match.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Domain.NotifyPropertyChangedAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Threading.BackgroundMethodAction.
devenv.exe Information: 0 :   not eligible because of PostSharp.VisualStudio.Services.QuickAction.Filters.PackageCompatibilityFilter does not match.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Threading.DispatchedAttribute.
devenv.exe Information: 0 :   not eligible because of PostSharp.VisualStudio.Services.QuickAction.Filters.PackageCompatibilityFilter does not match.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Threading.ObserverLockAction.
devenv.exe Information: 0 :   not eligible because of PostSharp.VisualStudio.Services.QuickAction.Filters.PackageCompatibilityFilter does not match.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Threading.ReaderLockAction.
devenv.exe Information: 0 :   not eligible because of PostSharp.VisualStudio.Services.QuickAction.Filters.PackageCompatibilityFilter does not match.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Threading.WriterLockAction.
devenv.exe Information: 0 :   not eligible because of PostSharp.VisualStudio.Services.QuickAction.Filters.PackageCompatibilityFilter does not match.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.ComponentInternalConstraintTypeAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.InternalImplementConstraintAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.ComponentInternalConstraintAction.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.InternalConstraintAction.
devenv.exe Information: 0 :   eligible.
devenv.exe Information: 0 : Determining eligibility of PostSharp.VisualStudio.Services.QuickAction.Actions.Architecture.ProtectedConstraintAction.
devenv.exe Information: 0 :   eligible.
devenv.exe Information: 0 :   found 1 actions

引起麻烦的部分说不合格,因为 PackageCompatibilityFilter 不匹配。这是什么意思?

更新 2 我的目标是 .NET 3.5;如果我切换到 .NET 4.5,日志记录就可用了。这是 PostSharp 的限制吗?

.NET 3.5 不支持 PostSharp 诊断模式库。其他模式库也是如此。

您必须使用 PostSharp 本身 (Aspect Framework) 来实现类似的逻辑。