dotTrace Unable to start profiling. Don't see registry value to edit

631 views Asked by At

I have a C#/WPF application that I built an installer - using Inno Setup - for. When I run the application with my installer it seems to hang at the last step of initialization before showing the main menu. Using procmon, event viewer, and more I know the app is still logging and has not crashed, the GUI hangs. However, the app runs fine when ran with Visual Studio.

I am at my wits end with what to try and decided to spin up dotTrace. I can run all of the profiling types except for Timeline. This image: dotTrace error image shows the error that pops up when I try to run Timeline profiling.

I wanted to use this application to see what is being called and when. I haven't been able to gain much insight from the other profiling types and am unsure how to resolve the attached error. I opened up regedit and do not see the EtwMaxLoggers variable as stated. Do I need to create a new variable? I also see three folders - Autologger, GlobalLogger, and Security. Should the variable be at the same level as all three folders - which seems to be what the error indicates? Or should the variable be inside of these folders? I recognize that a range of 32-256 for the value of the variable is given, but what is the implication of putting the value at either end of the range?

1

There are 1 answers

0
pschill On

The abbreviation "ETW" means "Event Tracing for Windows" and I found some information on the troubleshoot page about profiler errors and in the docs of the StartTraceW function.

The troubleshoot page suggests creating the exact same registry key that is mentioned in the question using the following command (from an elevated command prompt):

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI" /v EtwMaxLoggers /t REG_DWORD /d 128

This creates a new DWORD value with the name "EtwMaxLoggers" with the (decimal) value 128 in the "WMI" folder.

(Changing the value only takes effect after a reboot.)

To answer your question about the implication of putting the value at either end of the allowed range of 32 to 256:

The docs of the StartTraceW function (which registers and starts an event tracing session) contains important notes about the EtwMaxLoggers registry key:

Note that Loggers use system resources. Increasing the number of loggers on the system will come at a performance cost if those slots are filled. This limit exists to prevent excessive use of system resources.

The limit should only be manually adjusted by a system administrator to enable specific scenarios. The EtwMaxLoggers setting must not be automatically modified by a program or driver.

Low values (near 32) mean that less system resources are consumed. However, this means that more applications will fail to acquire these resources, so they will not work correctly anymore.

Higher values (near 256) mean that more applications, for example, dotTrace, can use the resources and help you with debugging. However, the system may slow down.