How can I add a Trace() to every method call in C#?

后端 未结 6 1592
忘掉有多难
忘掉有多难 2020-11-28 11:47

I am having a hard time tracking down a lock issue, so I would like to log every method call\'s entry and exit. I\'ve done this before with C++ without having to add code to

6条回答
  •  忘掉有多难
    2020-11-28 12:27

    How do you know that it's happening? If this is a multithreaded application, i would recommend testing for the condition and calling System.Diagnostics.Debugger.Break() at runtime when it's detected. Then, simply open up the Threads window and step through the call stacks on each relevant thread.

提交回复
热议问题