Click here to Skip to main content
15,868,164 members
Everything / General Programming / Debugging

Debugging

debugging

Great Reads

by PJ Arends
Trace your function calls to the Output window.
by Giovanni Scerra
Patterns to prevent null reference exceptions
by Maxim Kartavenkov
The series of articles covers most aspects of logging and tracing mechanisms which can be embedded into your application. It discusses simple ways of tracing and also new tracing technologies which were involved in Windows 10.
by David A. Gray
Historically, ETW has been portrayed as having a very steep learning curve, along the lines of the effort required to summit Everest. Realizing its potential value, I set about to reduce the effort to that required to summit Pike's Peak.

Latest Articles

by PJ Arends
Trace your function calls to the Output window.
by Maxim Kartavenkov
Discussion of how to organize saving application trace helper information.
by Maxim Kartavenkov
Continue discussion of the simple kernel drivers tracing mechanisms by using output information into the handles of the files pipes and console passed to the driver from the host application.
by Maxim Kartavenkov
Discussion of simple ways of tracing and also new tracing technologies involved in Windows 10

All Articles

Sort by Score

Debugging 

8 Mar 2024 by PJ Arends
Trace your function calls to the Output window.
26 Feb 2015 by Giovanni Scerra
Patterns to prevent null reference exceptions
18 May 2023 by Maxim Kartavenkov
The series of articles covers most aspects of logging and tracing mechanisms which can be embedded into your application. It discusses simple ways of tracing and also new tracing technologies which were involved in Windows 10.
8 Jun 2017 by David A. Gray
Historically, ETW has been portrayed as having a very steep learning curve, along the lines of the effort required to summit Everest. Realizing its potential value, I set about to reduce the effort to that required to summit Pike's Peak.
10 Mar 2022 by Greg Utas
No breakpoints or drooling all over the console!
13 Jan 2012 by baruchl
How to setup .NET symbol server and enable production debugging without source code
4 Feb 2012 by Huisheng Chen
Using reflection to dynamically verify if an assembly is in debug or release compilation
4 Sep 2014 by Ben M Watson
Learn how to use the debugger to answer implementation questions for yourself
18 Feb 2016 by Kuv Patel
Debug stored procedures in Visual Studio and SQL Server Management Studio.
13 Feb 2013 by nick.p.everdox
Working alongside Windows KPP (patchguard) and hooking system services
24 Oct 2018 by Mark Kruger
Visual Studio loader with arguments
16 Sep 2015 by mudasser ajaz
How to debug ionic Android application in development phase
15 Jun 2023 by Maxim Kartavenkov
Discussion of simple ways of tracing and also new tracing technologies involved in Windows 10
10 Dec 2011 by Sebastian Solnica
PDB files out of the debugger
20 Jun 2014 by Sebastian Solnica
Reference Source, dotPeek and Source Code Debugging
30 Jul 2014 by Sebastian Solnica
How you may noninvasively trace .NET applications with sysinternals tools
5 Jul 2023 by Maxim Kartavenkov
Continue discussion of the simple kernel drivers tracing mechanisms by using output information into the handles of the files pipes and console passed to the driver from the host application.
8 Nov 2011 by Hooga Booga
After a call to MSDN, I was finally able to get through this problem. We tried quite a number of things over a couple sessions, but the final solution was finally reached. From the command line I had to run:devenv /resetskippkgs We had run a couple of reset items similar to this, but this...
11 Dec 2013 by Sergey Alexandrovich Kryukov
Everything looks correct. If you don't see the arguments, I bet you did not enter any. Perhaps you don't know what is it; this is the only explanation I can think of. Your comment "arguments: A B C D" looks suspicious: what makes you thinking that the arguments are "A B C D"?So, make sure...
2 Dec 2014 by Sebastian Solnica
How to debug Windows services written in .NET
23 Mar 2015 by Duncan Edwards Jones
What to do (and how to do it) when confronted with a big ball of mud
4 Mar 2019 by Apriorit Inc, Artem K.
A clear overview on how you can establish communication between a device and its driver
10 Jun 2019 by Member 14492252
I have similar issue although in my case I could not access files on webapp in Azure. Updating VS and azure development component didn't help. What has worked for me was to revert cloud explorer to previous version: - Launch VS in administrator mode - From Tools menu select Extensions and...
13 Apr 2010 by Kythen
If you want to check for if two variables point to the same object instance, use Object.ReferenceEquals()[^].
11 Jun 2010 by Richard MacCutchan
Adeji wrote:cstrFullDetails.Format("serial: %s", pDnsRecord->Data.SOA.dwSerialNo); I may be wrong but it looks like you are trying to format a DWORD value as a string; the correct format control should be "%d". I think you are also overwriting your string with every cstrFullDetails.Format...
28 Sep 2011 by OriginalGriff
Easy peasy.Look on the Visual Studio menu bar: under the DEBUG menu, you will find "Exceptions". In the dialog that comes up, put a tick in every single check box, both under "thrown" and "User unhandled". (You might want to note which ones are ticked to start with) Press OK.Now, if you...
26 Feb 2012 by Raheel12345
How to attach all w3wp.exe processes to debugger with single click.
27 Dec 2012 by Member 8061245
Hello everyone . I am working right now on a script language which is interpreted to C# and then compiled via CSharpCodeProvidor .. (I have my own IDE for the script language)Well , firstly i want to understand how really VS can actually stop the application at runtime and then change...
27 Dec 2012 by Suvabrata Roy
Hi,Nice question and concept, but as per my knowledge if you want to debug then the whole application will pause until you resume so in real time if you start debugging then whole app will go to sleep for while and requests will queued up until they are timed out so that was my...
27 Dec 2012 by Oleksandr Kulchytskyi
Well to do that you must have an excellent knowledge in CLR and it's internall behavior and mechanism. Without it all your attempts will fail.Also you must have clear imagination of how CLR work with conjunction of JIT compiler.In brevity, you need to find a way to hhok up into the CLR...
15 Jul 2013 by Apriorit Inc, Kotik Anton
Modern anti-debug techniques - Nanomites and Debug Blocker - are considered for Windows and Linux code
22 Apr 2015 by Bartlomiej Filipek
PDB Was Not Found - Linker Warning
14 Aug 2019 by DaveAuld
Object inspection with %O in the console output
21 May 2021 by Jarek Szczegielniak
In this article we use Visual Studio Code to edit and debug our increasingly complex code running inside a Docker container.
N 28 Mar 2024 by CPallini
You failed to properly initialize playerRow, playerRow variables. Put a breakpoint at movePlayer function in order to see that live.
21 Sep 2010 by Paw Jershauge
umm, hmm ok...private void txtLog_TextChanged(object sender, EventArgs e) { string smile1 = ":)"; if (txtLog.Text.Contains(smile1)) { txtLog.Text = txtLog.Text.Replace(":)", "Happy"); }}Why even ask the question...
15 Apr 2011 by JF2015
You can sysinternals procdump utility. Just write a batchfile to start this tool and it will create a dump.http://technet.microsoft.com/en-us/sysinternals/dd996900[^]
26 May 2011 by #realJSOP
When all else fails, fire off some events and bask in the glow of the IDE's Progress tab.
28 Sep 2011 by Sergey Alexandrovich Kryukov
In addition to the good advice by Griff and Simon, I would advise one more recipe: if your debug execution stops at a breakpoint set in an exception handler block and you cannot see where the exception was thrown, you can examine the property System.Exception.Stack of currently caught exception....
30 Sep 2011 by Daniele Rota Nodari
I was glad to integrate your code into my C# application.Actually, within the debugger windows, I can't recognize any human-readable reference to the calling process, but the function is working. :)So, for whoever may be interested, the following code is my C# 4 equivalent:using...
27 Feb 2012 by Sebastian Solnica
I wrote a simple extension for the MDbg debugger that adds a watch-trace (wt) command to its shell, allowing you to display and customize the method call trees. In this post, I’m going to show you how this extension was built and how it can be used.
CSS
11 Oct 2013 by ASP.NET Community
Take control of your angle-brackets and optimize. Note: This article spans over the debugging tools for your CSS, JavaScript and other
6 Jan 2014 by Member 10336592
1) Right click on your project in VS2005 or VS2008 or VS2010.2) 2) Click on Properties3) 3) Click on Web tab4) 4) Under Servers, click on the radio button Use Visual Studio Development Server 5) Check Auto Assign Port radio button5) 6) Uncheck NTLM Authentication...
22 Jan 2014 by Sergey Alexandrovich Kryukov
Review your Debug/Exceptions settings in Visual Studio, [Main menu] => Debug => "Exceptions…" (Ctrl+D, E).—SA
6 Jun 2014 by leon de boer
KarnstenK sort of gives you the correct answer but it needs expandingThere are two units both trying to define "int8_t" and one of those is part of the standard C library it will be in "StdInt.H" in the system include directory of any C99 compliant compiler.Fixed width integer types...
30 Jun 2014 by johannesnestler
If you don't define the Symbol the code won't be contained - So simple answer "NO", That is the reason for a compiler switch opposed to normal if-else logic)
2 Dec 2015 by Dave Kreskowiak
OK, from the little information you provided, your code exploded on a LINQ query that involved a call to First(). Reading the documentation on the First() method, it says that for an InvalidOperationException to be thrown, you passed in a TSource that was empty.Judging by the stack trace,...
4 Feb 2016 by dan!sh
You are accessing the textbox in the thread you have created. You are doing this in your tw method. This is not allowed.You are only getting this error while debugging because illegal cross thread calls are only checked if debugger is attached. Here is the relevant part of code from MSDN[^]...
22 Aug 2016 by CPallini
After fixing a trivial bug ("\P"->"\tP") and removed the obsolete conio.h header inclusion, I compiled your code with g++ 5.3.1 and ran it successfully.Output sample: ACCOUNT DETAILS----------------------------------------------------A/c no. NAME Type ...
20 Mar 2017 by Jochen Arndt
The error is here:m_message = new char[strlen(value + 1)];That will allocate two characters less than required (random size when the passed string is empty).It must be:m_message = new char[strlen(value) + 1];The error is also present with G++ builds but not detected.
20 Feb 2018 by Mike Diack
Try Inside CRT: Debug Heap Management[^] But from my own notes also: This is a list of some of the know magic numbers used by Microsoft which can be useful to know when debugging an application. 0xABABABAB Guard Bytes used by HeapAlloc() or LocalAlloc to mark "no man’s land" after allocated...
17 Oct 2019 by VipinMittal18
How to enable debugging in Twig templates - Drupal 8
19 May 2020 by Dave Kreskowiak
No, there isn't. At least not by using the default visualizer. You may want to look into writing your own visualizer for an array type. But be warned. Creating a view of an entire array of expanded objects can take a LOT of time. Google: visual...
22 Sep 2020 by Richard MacCutchan
Try adding some of the Debugging Options (Using the GNU Compiler Collection (GCC))[^] so you can find more information when the abort happens.
6 Jan 2022 by Bernhard Nebel
Link-time optimization and debugging OO programs do not work very well together, at least on AVR MCUs.
18 Aug 2023 by Maxim Kartavenkov
Discussion of how to organize saving application trace helper information.
9 Apr 2010 by Poonamol
Hello,I had created a sample application in c.For compilation and execution on unix, i created makefile.I want to debug my c code, when i execute it from Unix.How can I debug my c code on unix platform?Thanks in advance. :-O
13 Apr 2010 by Dan Neely
I've lost about 6 hours over the last few days tracking down a bug that was caused by having two variables reference the same object when what I needed was to have the second one have its own copy of the first: MyObjectType foo = new MyObjectType()// lots of intervening code ...
25 May 2010 by Dylan Morley
Possibly have a read of this articlehttp://www.elumenotion.com/Blog/Lists/Posts/Post.aspx?ID=23[^]
11 Jun 2010 by Cedric Moonen
Did you make sure that bot hthe exe and the dll are using the same heap space ? This is extremly important and if they don't, that's certainly the source of your problem.
11 Jun 2010 by Adeji
Hi folks,I'm writing a simple DNS application that query DNS server for different type of DNS type such as A, NS MX, SOA and so on. At the beginning, everything started well. Sent query for A type record of a domain and got the reply, same for NS and PTR. But when I got to the implementation...
17 Aug 2010 by Niklas L
In the Debug | Exceptions dialog, you can specify how exceptions should be treated by the debugger. You can chose to break into the debugger when a specific exception is thrown.So if you know what type to look for, that could be one way of doing it.
16 Jan 2011 by #realJSOP
BTW, is this unmanaged code, or .Net?You can't run a DLL as a process. I had to do the same thing a bunch of years ago, and I just used interprocess comms by sending registered messages back and forth between the apps. You can send pointers to strings between the apps. There are a number...
16 Jan 2011 by Espen Harlinn
ACE[^] has just what you need - a flexible robust mechanism for loggingHere is a wee bit of info on Using the ACE Logging Facility[^]From your description, I would guess you could benefit from using ACE in a number of other ways too :)RegardsEspen Harlinn
21 Mar 2011 by Henry Minute
If it works when you rename the folder to 'Debug' is there any chance you have a hard coded path in there somewhere?
29 Jun 2011 by Albert Holguin
Linklist l; //Uninitilazed pointer to List structureLinklist l = (Linklist)malloc(sizeof(List));//Initialized pointer to List structure (heap)List l; //Initialized List structure (stack)
11 Jul 2011 by Kári Poulsen
Allows you to very easily see live trace output on any machine.
1 Aug 2011 by Albert Holguin
You can debug a DLL just like any other application in Visual Studio. All you have to do is tell Studio what executable will load the dll and you'll be able to debug from there. Here's a description: http://msdn.microsoft.com/en-us/library/605a12zt%28v=VS.90%29.aspx[^]If you debug in...
2 Aug 2011 by thatraja
OP solved the issue by using the below linkhttp://forums.asp.net/p/1704958/4535426.aspx/1?p=True&t=634478607027983451[^] posted by PhilCrompton[^]Comments by those twoPhilCrompton - 19 hrs agoYou are not the only one affected. See:...
9 Aug 2011 by Kevin.Efurd
ok, thanks everyone for your suggestions. it dawned on me that i did have to add some preprocessor definitions (read it in a post) after i upgraded to 2010 in order for the damn thing to compile. here's what i put in project properties > c/c++ > preprocessor > preprocessor...
4 Oct 2011 by Simon Bang Terkildsen
make sure that _DEBUG is definedproject properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions
26 Oct 2011 by net_prog
I am debugging a GC heap corruption and came to the step where I want to try running the program under WinDbg+PageHeap+AppVerifier+GCStress.I found at http://social.msdn.microsoft.com/Forums/en/clr/thread/0fcb5bb1-0cd8-40e4-96d9-f0cb8b6cdbdf[^] that I can enable GCStress like this: ...
7 Nov 2011 by Jyoti Choudhury
I have read all through problems and didn't find any good reason behind this. But I suspect one of your patch that you have installed on your PC. If possible try reinstalling all your products and as your OS is Win VISTA. Please try to run VS2005 with Compatibility settings.If it still...
8 Jan 2012 by YuriMaks
step 1) Start new win32 console application;step 2) Write code like that: CClass* c1 = new CClass();step 3) Place breakpoint on line written in step 2;step 4) Start debug;step 5) Press F11 ("step in").Now we can see that we jumped in "new.cpp". Can I customize the debugger so that it...
8 Jan 2012 by Paul M Watt
You can define these keys in the registry and take advantage of this "officially unsupported feature" in Visual Studio.The link depends on what version of Visual Studio you are running and if you are using a 32-bit or 64-bit OS.For Visual Studio 2008 on a 32-bit...
26 Jan 2012 by that143guy@yahoo.com
I have developed a WPF application on my workstation using Visual Studio 2010 Professional, which is a Windows 7 64-bit machine. I have been getting crash reports about the application on 2 other machines. One of them is a Windows XP 32-bit machine and another one is a Windows 7 32-bit...
18 Feb 2012 by Nilesh Patil Kolhapur
hey right-click on breakpoint and then click Condition on the shortcut menu.best luck
2 Mar 2012 by Clifford Nelson
The PDB files are regenerated everytime you compile in Debug mode. Therefore, they will be out of date. I beleive if there is a version update with the compile, then the system will recognize they are out of date. They contain the symbols, making it easier to debug since you Program can still be...
30 Apr 2012 by Saurabh.abhyankar
Solved the problem. Actually one of my dll's was refering to VC90 instead of VC100 as it should do for new Visual studio 2010. i deleted and recomplied this dll. Now its working fine. thanks for the support.
15 Jul 2012 by Sandeep Mewara
First of all, make sure you’re application pool is running the correct .NET Version:.NET 2.0, 3.0 and 3.5 web applications, should use an application pool that uses .NET 2.0.NET 4.0 web application, should use an application pool that uses .NET 4.0Now, based on the configuration and...
9 Nov 2012 by mlzg4
This stream implementation is fast, thread-safe, easy to use, and very useful for debugging large distributed or concurrent projects.
28 Nov 2012 by AnalogNerd
I have an application that uses Domain Authentication for access, Domain Roles allow/disallow access to parts of the application. The application also connects to a database. In production it does this through a trusted connection, the App Pool is set to run as domain account specifically used...
30 Nov 2012 by Sergey Alexandrovich Kryukov
By apparent reasons.For an unconditional breakpoint, you can seed a hardware instruction(s) to call a debugger. In particular, on x86, x86-64 or IE-64 instruction set architectures, there is a hardware support of debugging, and the interrupt instruction can be used to set a breakpoint....
17 Feb 2013 by OriginalGriff
If you are getting two errors related to the combobox, then the project you have built has not succeeded - a different project in the same solution may have.If you have any errors in the compilation, then a new EXE file will not be produced and any existing one will be run. Clear the errors,...
23 Jul 2013 by Richard MacCutchan
This definitely looks like a microsoft bug. If you run this in ASCII mode then the filenames returned are correct. If you run it in Unicode mode then all returned names are (approx) half the correct size. It looks like the code is miscalculating the filename length by dividing by 2 in a Unicode...
10 Sep 2013 by CPallini
I guess the Data Breakpoint[^] is what you are looking for, but I never used it, so I don't know how it exactly works.
16 Dec 2013 by thatraja
Check this articleDebug your ASP.NET Application while Hosted on IIS[^]
30 May 2014 by kaushik_code
A few days back I faced this problem at work and I was wondering is there a way to mint out more data from the scenario than to go to Microsoft. There has been many cases like this and I wanted to explore that as a windows developer what is the best /optimum way to fetch most of info is such...
30 May 2014 by Sergey Alexandrovich Kryukov
Such debugging is possible but not really productive, too much labor-taking. And having debugging without the ability to patch the PE (I used to work with the system providing patch facility, but that's far from Windows :-)) won't help you much.But you mentioned the "because it is locked by...
29 Jun 2014 by Kyriakos Akriotis
SharePoint Debugging Assistant (free Visual Studio 2012/2013 add-in)
21 Apr 2015 by Sergey Alexandrovich Kryukov
The leak in GDI objects is not the only possible memory leak. And the leak in any other unmanaged object is not the only possible memory leak. It could also be a managed memory leak, but that could be a different kind of leak, leak "by design" or by mistakes in the general code design.Please...
12 Aug 2015 by CPallini
int8_t should be defined in cstdint header. Possibly a non-standard header redefines it. I am pretty sure the compiler is reporting what are the conflicting headers.
7 Sep 2015 by C3D1
Hello,i am using VC6++.I have several *.lib projects in my workspace and some *.exe projects.For the *.exe projects PDB-Files were generated normally (im coming from VC2010 so i am really new to VC6) but when i compile the *.lib projects, no PDB Files are generated.I've checked the...
5 Nov 2015 by Zhivko Kabaivanov
This behavior is consistent with debugging optimized code.You can verify what code was generated by going to Tools -> ILDasm, loading your executable and inspecting that function. Or, while on a breakpoint in the Debugger, Debug -> Windows -> Disassembly (or click Alt+8).This may be a...
27 Jan 2016 by Patrice T
Quote:What do you think, what are your experiences? Did I miss an important concept or approach? Do you have special tool recommendations (or aversions ^^)?My experience is:When I deal with C or C++, I have a special behavior at quotation level.If I am requested to build an app, I do normal...
4 Mar 2016 by Richard Deeming
String literals need to be enclosed in quotes - "plate", not plate.Variables need to be definitely assigned before they can be used. The compiler isn't smart enough to work out that the price and description will always be assigned by the time that isValidOption is set to true. It would be...
19 Jul 2016 by Patrice T
Quote:Also, for a program like this, can anyone point out a debugger or technique that will help me fix this myself?Any debugger will do.You know what your program should do and how the variables should behave.You need to execute your program line by line on debugger.By inspecting the...
13 Feb 2018 by Patrick Skelton
Sorry for the general and (hopefully) simple nature of this question, but I can't find an answer to this for VS2017 anywhere. The step-into (F11 on my machine) function seems to be broken for constructors. Does anyone know how to alter this unhelpful behaviour? Update I must be missing an...