CNeptune
CNeptune copied to clipboard
Analytical anomaly
/// <summary> /// 泛型单例 /// </summary> /// <typeparam name="T"></typeparam> public abstract class BaseInstance<T> where T : class,new() { private readonly static object lockObj = new object(); private static T instance = null; protected bool IsConnect = false; public static T Instance { get { if (instance == null) { lock (lockObj) { if (instance == null) { instance = new T(); } } } return instance; } } } public class Testclass : BaseInstance<Testclass> { [OperationContract] public void Test(string a) { //return 3; } }
Demo code: static void Main(string[] args) { //define a joinpoint var _operationContractJoinpoint = new Func<MethodBase, bool>(_Method => _Method.IsDefined(typeof(OperationContractAttribute), true));
//instantiate a calculator
var _calculator = new Calculator();
//weave logging for all operation contract
Aspect.Weave<Logging>(_operationContractJoinpoint);
//invoke an operation contract (logging is enabled)
var _return = _calculator.Divide(15, 3);
Testclass.Instance.Test("test");
}
The .Net Reflector Analytical anomaly and NConcern.Example.Basic Demo Exception:
在 System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType) 在 System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters() 在 System.Reflection.RuntimeMethodInfo.GetParameters() 在 System.Diagnostics.StackTrace.ToString