Is there a possibility to log every call of methods (stack trace etc.) without开发者_运维问答 adding code to this method. What I want is to check on which method application stuck, but I do not want to add log code to every method.
It stuck but doesn't throw an error, so try catch with stack trace wouldn't help.
It's worth trying an AOP-based approach, such as PostSharp. You can use attributes on either classes or individual methods to control the logging.
For example, there's a PostSharp plugin to integrate with log4net.
If you absolutely can't touch the code at all then running the code in a profiler should help identify which method is getting stuck, at least you'll see it as a long running method provided it isn't throwing an exception and just exiting.
For example, Red Gate's Ants Performance Profiler is one such tool:
ANTS Performance Profiler
As an addition to Jon's answer I've been looking at AspectDNG.
Try "Process Explorer" to identify stucked call. You can find it at : http://technet.microsoft.com/en-us/sysinternals/bb896653
Use a debugger to attach to the process that's stuck?
精彩评论