Problem redirecting debug output to a file using trace listener

前端 未结 1 1093
天涯浪人
天涯浪人 2021-01-13 03:47

I have created a debug listener to redirect the output from the Debug/Console window to a file(with a call stack), using the following code:

void SomeMethod(         


        
相关标签:
1条回答
  • 2021-01-13 04:17

    Here's an article that answers a part of my question: http://www.codeproject.com/KB/trace/DbMonNET.aspx

    i.e. how to capture the output of the Debug/Console window. But, it seems that there's no way of getting the stack trace from this output. Looking from this perspective it looks like a bad approach anyway.

    FURTHER RESEARCH: Looks like these exceptions are appearing because they are handled in some other dll that is not linked properly, and they are handled there instead of my try/catch blocks. This is probably the place where I should be looking my error for i.e. where there's a dll reference I should instead add a project reference.

    MORE RESEARCH: Enable breaking at exceptions in Visual Studio main menu: Debug -> Exceptions -> Check the type of exceptions you want the application to break at(Common Language Runtime)...There's no better way to deal with exceptions.

    0 讨论(0)
提交回复
热议问题