I have this simple program, the problem is that the code never reaches TestClassAttribute class. The console output is:
init executed end The Code
class Program { static void Main(string[] args) { Console.WriteLine("init"); var test = new Test(); test.foo(); Console.WriteLine("end"); Console.ReadKey(); } public class TestClassAttribute : Attribute { public TestClassAttribute() { Console.WriteLine("AttrClass"); Console.WriteLine("I am here. I'm the attribute constructor!"); Console.ReadLine(); } } public class Test { [TestClass] public void foo() { Console.WriteLine("executed"); } } }
TestClassAttribute, e.g. withnew TestClassAttribute().