调试器未输入自定义属性类 [英] Debugger is not entering custom attribute class
本文介绍了调试器未输入自定义属性类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是用于桌面的C#WPF应用程序。我已经创建了一个自定义属性类,但在调试中它从来没有进入过。我是否需要向此类添加其他内容?
This is a C# WPF application for a desktop. I've created a custom attribute class but in debug it never goes in there. Do I need to add something else to this class?
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class Authentication : Attribute, IPrincipal
{
public Authentication(string id)
{
throw new NotImplementedException();
}
public IIdentity Identity { get; private set; }
public bool IsInRole(string role)
{
throw new NotImplementedException();
}
}
方法是:
[Authentication(SecurityConstants.DataEntrySupervisor)]
[Authentication(SecurityConstants.DataVerificationClerk)]
public void Submit(EventObject eventObject)
{//////////}
推荐答案
运行时不会以任何方式调用属性。直到您进行反思之后,它才可能被实例化。
An attribute is not called by the runtime in any way. It probably does not even get instanciated until you poke around with reflection.
您可以查看 SecurityAttribute 。
这篇关于调试器未输入自定义属性类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文