473,320 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

jitDebugging


I am trying to enable jitDebugging in the machine.config file.

I have amended it to read:

<configuration>
<system.windows.forms jitDebugging="true" />
<configSections>
<section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />

etc..

Now when I load a project I get an error in the IDE:

Unrecognized configuration section system.windows.forms.
(C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Con fig\machine.config line
13)

I thought I had followed the instructions but apparently not. Can anybody
tell me what line I need to add and where to put it please?

--
Jeff Gaines
Aug 16 '07 #1
9 24211
Hi Jeff,

Setting jitDebugging in the machine.config file means turning on the
Winform JIT debugging feature for the entire machine. Is this what you
wanted to achieve?

If you only wanted to enable JIT debugging for certain Winform project, you
may just add jitDebugging attribute to app.config. Steps are listed below:
1. In Solution Explorer, right click the project item. Select Add-New
Items....
2. In the dialog, find "Application Configuration File" and click "Add"
3. Input the following content in the app.config:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

I have also tried to add <system.windows.forms jitDebugging="true" /to
the machine.config in the path:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Conf ig. But I did not get any
error in VS2005 IDE.

Can you provide detailed steps to help me reproduce the problem? Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 17 '07 #2
On 17/08/2007 in message <84**************@TK2MSFTNGHUB02.phx.gbl>
"Jeffrey Tan[MSFT]" wrote:
>Hi Jeff,

Setting jitDebugging in the machine.config file means turning on the
Winform JIT debugging feature for the entire machine. Is this what you
wanted to achieve?
I do, I am not sure if the problem is in my code or in a bought in
component so I thought this would be the best way :-)
>I have also tried to add <system.windows.forms jitDebugging="true" /to
the machine.config in the path:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Con fig. But I did not get any
error in VS2005 IDE.

Can you provide detailed steps to help me reproduce the problem? Thanks.
I opened machine.config in a text editor (Ultraedit) and altered it to read:

<configuration>
<system.windows.forms jitDebugging="true" />
<configSections>
<section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />

[file continues]

When double clicking a solution file and trying to look at a form I get
the following error in the IDE:

Unrecognized configuration section system.windows.forms.
(C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Con fig\machine.config line
13)
Hide

at System.Configuration.ConfigurationSchemaErrors.Thr owIfErrors(Boolean
ignoreLocal)
at
System.Configuration.BaseConfigurationRecord.Throw IfParseErrors(ConfigurationSchemaErrors
schemaErrors)
at System.Configuration.BaseConfigurationRecord.Throw IfInitErrors()
at System.Configuration.ClientConfigurationSystem.Ens ureInit(String
configKey)

Line 13 is the line I added. It doesn't look anything like the other lines
though which are more complex. Everything works fine if I take that line
out.

XML/HTML is a bit of a mystery to me so I wondered if I am doing something
wrong that would be obvious to somebody who understands it better?

--
Jeff Gaines
Aug 17 '07 #3
On 19/08/2007 in message <xn***************@msnews.microsoft.comJeff
Gaines wrote:

Sorry to follow up my own post but I have now carried out a clean install
of XP Pro (MSDN retail) SP2 on the box that had Vista on it. I then
installed VS2005 and SP1 for VS2005.

I started a small test app and made sure it ran OK then altered
machine.config to read:

<configuration>
<system.windows.forms jitDebugging="true" />
<configSections>
<section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />
etc.

I also added App.config to the project which reads:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

The good news is the app continues to build and run and the IDE does not
complain about the configuration. But JITDebugging does not appear to
work. I introduced a divide by zero error in the app which is triggered on
a button press. I ran the app directly from its .exe file outside the IDE
and when it hits the error a dialog appears offering Details, Continue or
Quit. Clicking details produces a listing of the problem with instructions
for configuring JITdebugging.

Am I correct in believing that I should get an opportunity to run the
de-bugger? If so I seem to have a real issue here.

I have checked the registry and all the keys are there with appropriate
values and correct paths.

What a pity the IDE doesn't have an option to just turn on machine wide
JITDebugging!

The machine has been re-booted several times so VS2005 should be reading
the updated machine.config.

--
Jeff Gaines
Aug 19 '07 #4
Hi Jeff,

Thank you for the kindly feedback.

Yes, I can reproduce out this problem. I have tried to add the
jitDebugging=true in app.config for a sample Winform project. However, the
..Net Winform default error dialog still shows without enabling JIT
debugging.

I have test this on more than 3 machines, only one Vista machine pops up
the JIT debugging dialog. The XP and Win2003 testing machines both have the
same problem as you(JIT debugging not working).

I have tried to use Process Monitor from sysinternals to log the
[appname].exe.config file access records. I find that CLR really probes the
[appname].exe.config file during process startup. However, for unknown
reason, the jitDebugging=true setting did not work as expected.

Anyway, I will perform some further research to find out the root cause. I
will get back to you ASAP. Thanks for your patient.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 20 '07 #5
Hi Jeff,

Sorry for letting you wait.

I have performed intensive debugging over this issue. Finally, I found the
root cause.

It seems that we should not place the <system.windows.forms
jitDebugging="true" /section in the begin of the machine.config. This
will break the .Net Winform JIT debugging feature..Net will always probe
the machine.config <system.windows.formssection before app.config. If we
remove this section from machine.config, app.config <system.windows.forms
jitDebugging="true" /will ok without any problem. You may give it a try.

Also, to use <system.windows.forms jitDebugging="true" /in the
machine.config at the machine-wide. You have to place the
<system.windows.forms jitDebugging="true" /at the end closing of
<configuration>, just before </configuration>, like this:
....
</system.web>
<system.windows.forms jitDebugging="true"/>
</configuration>

Based on my testing, this works well on my machine.

If you are curious about the internal debugging result, below is some
information.

If .Net winform can probe jitDebugging="true" in app.config, it will setup
a "DebuggableCallback" for the window procedure, if not, it will use
"Callback". "Callback" method will set a big try...catch to catch any
exception in the Winform app and display an error dialog, see the code
below(OnThreadException in the code will show the error dialog):
private IntPtr Callback(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam)
{
Message m = Message.Create(hWnd, msg, wparam, lparam);
try
{
if (this.weakThisPtr.IsAllocated && (this.weakThisPtr.Target !=
null))
{
this.WndProc(ref m);
}
else
{
this.DefWndProc(ref m);
}
}
catch (Exception exception)
{
this.OnThreadException(exception);
}
finally
{
if (msg == 130)
{
this.ReleaseHandle(false);
}
if (msg == NativeMethods.WM_UIUNSUBCLASS)
{
this.ReleaseHandle(true);
}
}
return m.Result;
}

While "DebuggableCallback" will not catch the dialog but let the exception
throw out for JIT debugging:

private IntPtr DebuggableCallback(IntPtr hWnd, int msg, IntPtr wparam,
IntPtr lparam)
{
Message m = Message.Create(hWnd, msg, wparam, lparam);
try
{
if (this.weakThisPtr.IsAllocated && (this.weakThisPtr.Target !=
null))
{
this.WndProc(ref m);
}
else
{
this.DefWndProc(ref m);
}
}
finally
{
if (msg == 130)
{
this.ReleaseHandle(false);
}
if (msg == NativeMethods.WM_UIUNSUBCLASS)
{
this.ReleaseHandle(true);
}
}
return m.Result;
}

To use "DebuggableCallback" or "Callback" is determined in the following
method by checking WndProcShouldBeDebuggable property:

internal void AssignHandle(IntPtr handle, bool assignUniqueID)
{
lock (this)
{
this.CheckReleased();
this.handle = handle;
if (userDefWindowProc == IntPtr.Zero)
{
string lpProcName = (Marshal.SystemDefaultCharSize == 1) ?
"DefWindowProcA" : "DefWindowProcW";
userDefWindowProc = UnsafeNativeMethods.GetProcAddress(new
HandleRef(null, UnsafeNativeMethods.GetModuleHandle("user32.dll")) ,
lpProcName);
if (userDefWindowProc == IntPtr.Zero)
{
throw new Win32Exception();
}
}
this.defWindowProc = UnsafeNativeMethods.GetWindowLong(new
HandleRef(this, handle), -4);
if (WndProcShouldBeDebuggable)
{
this.windowProc = new
NativeMethods.WndProc(this.DebuggableCallback);
}
else
{
this.windowProc = new NativeMethods.WndProc(this.Callback);
}
....................

While this "WndProcShouldBeDebuggable " property checking logic is
implemented in the "WndProcFlags" static property:

internal static bool WndProcShouldBeDebuggable
{
get
{
return ((WndProcFlags & 4) != 0);
}
}

private static int WndProcFlags
{
get
{
int wndProcFlags = NativeWindow.wndProcFlags;
if (wndProcFlags == 0)
{
if (userSetProcFlags != 0)
{
wndProcFlags = userSetProcFlags;
}
else if (userSetProcFlagsForApp != 0)
{
wndProcFlags = userSetProcFlagsForApp;
}
else if (!Application.CustomThreadExceptionHandlerAttached )
{
if (Debugger.IsAttached)
{
wndProcFlags |= 4;
}
else
{
wndProcFlags =
AdjustWndProcFlagsFromRegistry(wndProcFlags);
if ((wndProcFlags & 2) != 0)
{
wndProcFlags =
AdjustWndProcFlagsFromMetadata(wndProcFlags);
if ((wndProcFlags & 0x10) != 0)
{
if ((wndProcFlags & 8) != 0)
{
wndProcFlags =
AdjustWndProcFlagsFromConfig(wndProcFlags);
}
else
{
wndProcFlags |= 4;
}
}
}
}
}
wndProcFlags |= 1;
NativeWindow.wndProcFlags = (byte) wndProcFlags;
}
return wndProcFlags;
}
}

So, finally, it is "AdjustWndProcFlagsFromConfig" method that probes
"machine.config" and "app.config":
[MethodImpl(MethodImplOptions.NoInlining)]
private static int AdjustWndProcFlagsFromConfig(int wndProcFlags)
{
if (WindowsFormsSection.GetSection().JitDebugging)
{
wndProcFlags |= 4;
}
return wndProcFlags;
}

This is my findings. But I still did not find out why .Net will not allow
the <system.windows.forms jitDebugging="true" /section to reside at the
begin of the machine.config. Anyway, I think we have a resolution for the
problem now.

Hope it helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 22 '07 #6
On 22/08/2007 in message <hB**************@TK2MSFTNGHUB02.phx.gbl>
"Jeffrey Tan[MSFT]" wrote:
>Hi Jeff,

Sorry for letting you wait.
Goodness me, that wasn't a wait :-)
>I have performed intensive debugging over this issue. Finally, I found the
root cause.
Well done!
>This is my findings. But I still did not find out why .Net will not allow
the <system.windows.forms jitDebugging="true" /section to reside at the
begin of the machine.config. Anyway, I think we have a resolution for the
problem now.

Hope it helps.
It most certainly does and it now works here as well!

Thank you for all the effort you have put into this, it is very much
appreciated.

I wonder why it hasn't been noticed by other programmers in the community.
Although I sometimes think it is a miracle that computers, and complex
software, work at all rather than sometimes they don't.

Many thanks again :-)

--
Jeff Gaines
Aug 22 '07 #7
Hi Jeff,

Glad to see my reply can help you.

Yes, I am also surprised to see that no people mentioned this behavior yet.
I think this is because few people tries to enable the Winform jitdebugging
on machine wide, they normally enable it in app.config.

Anyway, if you need further help, please feel free to post, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 23 '07 #8
Hi Jeff,

I am not sure if you are still curious about the root cause. I have
discussed our findings with product dev team in Microsoft. I think we have
the explanation now:

Basically, the <configSectionselement contents describe the classes to
use to read and interpret subsequent various configuration sections (thus
the name). If you search in the machine.config, you will find that there is
a child section element:
<section name="system.windows.forms"
type="System.Windows.Forms.WindowsFormsSection, System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

This tells .NET that the System.Windows.Forms.WindowsFormsSection class
should be used to read the contents of the "system.windows.forms" element.
Only after processesing this element does the system know what type to use
to read the configuration\system.windows.form element.

So our configuration\system.windows.form element must follow the closing of
the configSections element. We can place this element anywhere in
machine.config as a direct child of the configuration element as long as it
follows the close of the configSections element, not necessarily just at
the end of machine.config.

This explains why setting the <system.windows.forms jitDebugging="true" />
before <configSectionswill fail mysteriously.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 24 '07 #9
On 24/08/2007 in message <Fq**************@TK2MSFTNGHUB02.phx.gbl>
"Jeffrey Tan[MSFT]" wrote:
>So our configuration\system.windows.form element must follow the closing of
the configSections element. We can place this element anywhere in
machine.config as a direct child of the configuration element as long as it
follows the close of the configSections element, not necessarily just at
the end of machine.config.

This explains why setting the <system.windows.forms jitDebugging="true" />
before <configSectionswill fail mysteriously.

Hope this helps.
Yes indeed, thanks Jeffrey, carefully saved :-)

--
Jeff Gaines
Aug 24 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: swb | last post by:
Hi - I have a simple project that manipulates Adobe Illustrator that works fine at home on Windows XP Pro (with admin login), but gives me an error (error message and source code below) at work...
0
by: sonu | last post by:
Hi I have developed a smart client application. When i try to execute it. It displays the first form which is the login screen. On giving the corrent login id and password, the main form opens....
0
by: hesing Qiang | last post by:
In Print Process,I use the code,but it is not run correctly On WINDOWS 98 . I didn't know why ...? this.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular,...
0
by: Eugene | last post by:
Hello all, I've been trying to figure this out for a few days now, and still have no clue what's going on... I have a few related tables in MS Access (Clients, Cars, Sales), and a datagrid,...
1
by: Rene | last post by:
I have scoured the news groups to try to find a way to enable the Just In Time Debugger feature and have not been able to find an answers to my problem. Like many others, I have changed the...
6
by: Steve Long | last post by:
Help, I'm running VS.NET 2003 and when I try to start my application, I get the "unhandled exception" dialog instead of the IDE highlighting the offending line of code. The problem appears to be...
1
by: paul | last post by:
I have a Windows vb.net app that creates an Object from a .net dll that I wrote. If the dll fails to achieve its task I get it the re-throw an exception. the windows app encapulates the object...
1
by: active | last post by:
When I run an app outside of the IDE I get the exception Thread was being aborted Does that error mean something to you? Any idea what might be causing it? ++++++++++++++++
3
by: anniemae | last post by:
What is this? one error message pops up: <configuration><system.windows.forms jitDebugging="true" /> another one is: "<?include[inc/db" to type 'Double' is not valid another is:
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.