none
Enabling JIT Debugging in app.config

    Question

  • I need to enable JIT Debugging in one of my apps. It seems to be working fine in another one even larger and more complex. I have never included the required statement in the app config in there but enabled it for all three codes (managed, native, script) in the Tools=>Options=>Debugging=>Just In Time

    With this app it does not work this way and I have no explanation. The prompt offered by the system when it shows the exception is this:

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>

    I tried some variants

                    </roleManager>
    	</system.web>
    	<configuration>
    	      <system.windows.forms jitDebugging="true" />
    	</configuration>
    </configuration>

    In the xml above I placed the insert at the very bottom of <configuration> section.

    This gives me the following. The app breaks down as expected. It seems the JIT debugger starts working and I get this exception:

    System.Configuration.ConfigurationErrorsException was unhandled
      Message="Configuration system failed to initialize"
      Source="System.Configuration"
      BareMessage="Configuration system failed to initialize"
      Line=0
      StackTrace:
           at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
           at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
           at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
           at System.Configuration.ConfigurationManager.GetSection(String sectionName)
           at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
           at System.Net.Configuration.SettingsSectionInternal.get_Section()
           at System.Net.Sockets.Socket.InitializeSockets()
           at System.Net.NetworkInformation.NetworkChange.AddressChangeListener.StartHelper(NetworkAddressChangedEventHandler caller, Boolean captureContext, StartIPOptions startIPOptions)
           at System.Net.NetworkInformation.NetworkChange.add_NetworkAddressChanged(NetworkAddressChangedEventHandler value)
           at tapTCPports_1.Form1.Main()
      InnerException: System.Configuration.ConfigurationErrorsException
           Message="Unrecognized configuration section configuration. (C:\\VCSharp_Projects\\tapTCPports_1\\bin\\Release\\tapTCPports_1.exe.Config line 55)"
           Source="System.Configuration"
           BareMessage="Unrecognized configuration section configuration."
           Filename="C:\\VCSharp_Projects\\tapTCPports_1\\bin\\Release\\tapTCPports_1.exe.Config"
           Line=55
           StackTrace:
                at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
                at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
                at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
           InnerException:

    InnerException was empty.

    Other variants were ignored.

    What is the right way to enable the JIT Debugger?

    BTW the app works fine in debug and until half an hour ago worked fine in realese also but I've been making numerous changes and one of them apparently upset the balance and I cannot trace it back to the goilty point.

    Thanks.


    AlexB
    Friday, May 15, 2009 3:01 PM

Answers

  • Hi AlexBB,

    I'm not sure JIT debugging is actually starting in this scenario. It looks more like it's bombing out while trying to get the configuration.

    I wonder why you're using nested <configuration> elements in the XML.

    Possibly an XML variant which appeared to be ignored was valid, but debugging wasn't actually enabled under Tools > Options. I'm sure you took the steps to turn it on, but apparently under some circumstances you have to be running with administrative privileges to reset the registry keys in question. You could try toggling those settings while running VS as Administrator, and then recompiling.

    If that doesn't work, maybe there's some other detail we've overlooked in the procedures for enabling JIT debugging:

    You can enable Just-In-Time debugging from the Options dialog box. For more information, see How to: Enable/Disable Just-In-Time Debugging.

    For Windows forms, you must also enable Just-In-Time debugging in the machine.config or application.exe.config file. For more information, see How to: Enable Just-In-Time Debugging for Windows Forms.

    I'm sure you've already seen those links, but sometimes when you read things again the answer will jump out at you.
    Saturday, May 16, 2009 5:05 AM
  • That's right, why are you nesting the <configuration> node? I think the config should look more like this:

    ...
            </roleManager>
        </system.web>
        <system.windows.forms jitDebugging="true" />
    </configuration>
    Saturday, May 16, 2009 2:07 PM

All replies

  • Hi AlexBB,

    I'm not sure JIT debugging is actually starting in this scenario. It looks more like it's bombing out while trying to get the configuration.

    I wonder why you're using nested <configuration> elements in the XML.

    Possibly an XML variant which appeared to be ignored was valid, but debugging wasn't actually enabled under Tools > Options. I'm sure you took the steps to turn it on, but apparently under some circumstances you have to be running with administrative privileges to reset the registry keys in question. You could try toggling those settings while running VS as Administrator, and then recompiling.

    If that doesn't work, maybe there's some other detail we've overlooked in the procedures for enabling JIT debugging:

    You can enable Just-In-Time debugging from the Options dialog box. For more information, see How to: Enable/Disable Just-In-Time Debugging.

    For Windows forms, you must also enable Just-In-Time debugging in the machine.config or application.exe.config file. For more information, see How to: Enable Just-In-Time Debugging for Windows Forms.

    I'm sure you've already seen those links, but sometimes when you read things again the answer will jump out at you.
    Saturday, May 16, 2009 5:05 AM
  • That's right, why are you nesting the <configuration> node? I think the config should look more like this:

    ...
            </roleManager>
        </system.web>
        <system.windows.forms jitDebugging="true" />
    </configuration>
    Saturday, May 16, 2009 2:07 PM
  • I always invoke my VS as Administrator. It is default. I will try your suggestion. Thanks.
    AlexB
    Monday, May 18, 2009 2:49 PM