Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show messages logged through the Trace and Debug classes #380

Open
riQQ opened this issue Nov 7, 2024 · 2 comments
Open

Show messages logged through the Trace and Debug classes #380

riQQ opened this issue Nov 7, 2024 · 2 comments
Labels
debugger Relating to the debugger component question Further information is requested

Comments

@riQQ
Copy link

riQQ commented Nov 7, 2024

Problem Description

I want to see the messages logged through the Trace and Debug classes the same way I can see them in VisualStudio's Output window.

Proposal

Show the messages logged through the Trace and Debug classes in the dnSpy Output window the same way I can see them in VisualStudio's Output window.

Alternatives

-

Additional Context

I tried the latest build and it doesn't show any messages logged through the Trace and Debug classes on .NET Framework 4.8.

Debug and Trace use the DefaultTraceListener by default.

By default, the Write and WriteLine methods emit the message to the Win32 OutputDebugString function and to the Debugger.Log method.

@riQQ riQQ added the enhancement New feature or request label Nov 7, 2024
@ElektroKill
Copy link
Member

Hi, in order for Debug and Trace class to be able to display messages you must disable this option.

image

This option, when enabled, patches the code for the Debug class in order to prevent detection of dnSpy. One of these patches is to the Debugger.IsLogging() method. The patch makes this method always return false to simulate the program not being ran by the debugger.

This then causes this code to not call Debugger.Log which means the message does not get sent to the .NET debugger engine and thus does not get sent to dnSpy.
image

@ElektroKill ElektroKill added question Further information is requested debugger Relating to the debugger component and removed enhancement New feature or request labels Nov 20, 2024
@riQQ
Copy link
Author

riQQ commented Nov 22, 2024

Thanks, that works.

What do you think about adding a tooltip to that option saying that activating it leads to the Output window not showing Debug and Trace messages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger Relating to the debugger component question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants