RE: Step by Step skips large chunks of code



I spent most of the day yesterday trying to isolated this. I verified the
project settings it is in debug mode and no optimization is set.

This is a large project with several imported dlls. One of the DLLs is a
managed cpp dll. When stepping into this dll it exhibits the same behaivor as
the C# dll.

We have several similar projects that debug fine, just this one has
something different about it .

The interesting thing is the code that is skipped is not consistent. I one
subroutine I have a break point at the beginning of the routine. The first
execution will debug the first 100 lines then skip. The next execution will
skip after 3 lines, the next time it could do 10 lines or even skip the break
point entirely.

If I start debugging from the beginning of the program everything goes along
fine until the process starts spinning up threads. Once these threads have
started running then debugging seems to deterioate.

This process/program will also invoke several other programs that may be C#
or VB, those program exhibit the same debugging issues. Based on the fact
that I have the problem with called CPP/managed routines and with C#/VB
invoked routines it has to have something to do with the process not
necessarily with the project settings since each of these components where
compiled separately and debug fine under different processes.

I am going to create a new project has you suggested, and if that doesn't
work I will move it to a XP/32 bit machine and try it. This is not a simple
task, the project is a service and uses MSMQ as its internal trigger and may
have 20-30 threads running processing queued items.

For my testing I have restricted input to a single queue and removed the
invoke to external dependancies.
--
Scott


""Hongye Sun [MSFT]"" wrote:

Hello Scott,

Thanks for your post.

One of the reason for such kind of problem is code optimized. Compiler will
decide to skip some code if they are not necessary to execute.
In order to check if the project code has been optimized. Could you please
check the following settings:
1. Is the project compiled as debug mode or release mode?
2. In project properties page, switch to [Build] tab, and check if the
[optimize code] option is checked?

Visual Studio also provide a powerful tool for us to check if the C# code
has been correctly complied into assembly code.
When a breakpoint is hit, open menu [Debug] / [Windows] / [Disassembly]. It
will switch the source code tab to a Disassembly tab. Inside the
Disassembly tab, we could see that every C# statement with its associated
assembly code below. If there is no assembly code below the C# code, that
tells us this C# code has been optimized. We could also use F10 (Step Over)
to debug it at assembly code level to check if the debugger skips assembly
code.

The solution to code optimized is to uncheck the [optimize code] and switch
compile mode to debug.

If the solution does not work, I would suggest you to create a new project
with default project settings and copy the debugged code into the new
project. Debugging the same code with another project let us eliminating
the project settings' impaction.

In the meanwhile, you could send me your project zip file, so that I could
help you analyze the code and project settings. (My email address is
hongyes@xxxxxxxxxxxxxxxxxxxx, remove 'online.')

Please feel free to let me know if you have any question. I will be more
than happy to be assistance.

Regards,
Hongye Sun (hongyes@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

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://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


.



Relevant Pages

  • RE: Step by Step skips large chunks of code
    ... The interesting thing is that it still skips code during debug but not ... has been correctly complied into assembly code. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vsnet.debugging)
  • Re: debugging in release mode
    ... I have no doubt that it's a problem of mine and not of the compiler. ... I don't really need optimization ... for the sake of memory space or execution speed. ... shows the differences between the default debug mode and the default release ...
    (microsoft.public.vc.mfc)
  • cpufreq oddness on 2.6.16-rc1-mm4
    ... Some debug info, dmesg, and config are below. ... # Console display driver support ... # USB Device Class drivers ...
    (Linux-Kernel)
  • RE: =?iso-8859-1?Q?=22System.Diagnostics.Debug.WriteLine=22_Doesnt_work_unde?= =?iso-885
    ... Regarding on the DebugView and ASP.NET Debug output in IIS hosted ... I think it is due to the different logon session the ... ASP.NET worker process and your debugview running under. ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Unable to copy file. ... Access to the path ... is denied.
    ... The Debug Directory was included in the project. ... ** it the service app used(configured in windows Service manager) when you ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vsnet.general)

Loading