Click here to Skip to main content
15,887,485 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 Updated

Debugging 

15 Jan 2010 by #realJSOP
Your application is throwing an exception, and there's no handler for it. The JIT debugger message comes up because you're running the debug version of your application.The fix is to find out what the exception is, fix the problem, and recompile.
8 May 2010 by #realJSOP
Google is your friend. I used this search phrase ("c# detect usb device"), and this was the first of over 3.1 MILLION hits:http://www.dotnet247.com/247reference/msgs/32/164968.aspx[^]The second hit is for an article right here on CodeProject.Happy googling.
25 May 2010 by #realJSOP
It seems to me that if you want to debug it, the pdb file should be in the same folder as the DLL. BTW, does the DLL HAVE to be in the GAC?
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...
26 May 2011 by #realJSOP
When all else fails, fire off some events and bask in the glow of the IDE's Progress tab.
24 Jan 2020 by 10xlearner
Bug fixes and defensive programming
23 Oct 2011 by _Ashish
I am trying to debug the following T4 template file using VS2010 professional , windows 7.But debugger doesn't highlight the Correct line in the File : "Texttemplate2.tt"File 1: File1.tt
29 Aug 2011 by _Zorro_
Hi,There are some tools out there, but if you really intend to do some tests you should investigate a bit more.Testing is not that hard, it's just a question of reading, understanding and applying what you've learned.Have a read about Unit Testing and Integration Testing, this should...
19 Jul 2016 by Aamir Yousafi
Dear all,I'm stuck on code below and can't seem to figure out why it keeps crashing. It's supposed to be a simple quicksort algorithm in C but it's giving me a segmentation fault and crashing after I enter the input. I debugged it with Dev C++ and it shows that it's crashing in the...
7 Jul 2014 by Abdallah Al-Dalleh
Hello allDoes anyone tried ofstream on debugging ? In my case when it passes the write statement nothing is written on the file but on the normal run it writes to the file normally. I have a bug I need to check in the log file but through debugging. Thanks for the help! :)
27 Sep 2010 by Abhijit Jana
In this blog post I am going to explain how you can customize the complete view of the debugging window during debugging of application. By complete view means, where you can add own Properties, can customize the result, manipulate the data, hide properties which may not need during debugging etc. I
23 May 2010 by Abhinav S
You cannot debug the C# source code of the dll unless you have the dll.You can view the disassembly to view assembly level code while debugging.
30 May 2010 by Abhinav S
See here. This does not explain the log but it may just help a little.
20 Jul 2011 by Abhinav S
From this I take it you are trying to call a web service or database which could have a timeout.That could be a factor here?
10 Jul 2015 by Abhipal Singh
It looks like you are having an old DLL somewhere which is in use and is not allowing the debugger to hit your code. Try the following:1) Close your solution and delete all the DLLs in the build folder. (EDIT: Also, remove all output folders and obj folder to delete the PDBs as SA...
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...
4 Apr 2011 by Adil Mughal
Demonstrate the functionality provided by Debug class in .NET
2 Mar 2015 by Aditya_Goud
I m using Visual Studio for windows Phone to develop an Windows Application i m passing some values to my Server in XML Query .. all the value are getting received except a single value . i have throughly checked for any XML tags errors through breakpoints etc etc and checked the values in...
16 Mar 2015 by Aditya_Goud
u don't Have that .. especially in SDK, u can write a specific allocated value to output log using Debug.Writeline, the best debugging methods are provided my VS u can debug and see the values in OUTPUT and LOCALS windows
19 Mar 2015 by Aditya_Goud
Hi ,I am developing a Windows Mobile app that has a page where user sends some Data to server. The thing is.. ! Application Works Perfectly Fine in Enumerator and also when i m debugging it in my mobile using Visual Studio using a Cable wire Connected.. but when i use the app in phone without...
11 Jun 2010 by Aescleal
Here's a suggestion - don't use new and delete. You're making loads of work for yourself managing sizes and what nots, why not just use a vector? And you don't need to manually close files, that's one of the reasons they're objects.std::vector read_file( const std::string &file_name...
11 Jun 2010 by ah123ah
I am converting an MFC application for deadlock detection in to Simple console application. During this process I found many errors saying like:error C2365: 'CmdLockMutex' : redefinition; previous definition was 'enumerator'I am unable to remove this error.Kindly if someone could help...
11 Sep 2018 by ahmed_sa
Problem How to know which events fires from start of windows form running like load then textchanged etc.... . I have some variables on load of form . these variables have override to it . but i dont know on which place or event fires after load this windows form is very big coding lines ...
1 May 2010 by Ajay Vijayvargiya
This feature may not seem useful initially, and might appear distracting you. But it is one of the very useful (new) features in Visual Studio 2010. You'll love it after using it for a while!While debugging, you typically put some variables in Watch Window (or use Locals, Autos etc). When...
4 Feb 2016 by Al_Brown
As an alternative to using a background worker you can use BeginInvoke to ensure the text is changed on the main user interface thread.This CodeProject article gives a very good overview and has a code example doing almost exactly what you need to fix your sample code.
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)
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...
1 Aug 2012 by Albert Holguin
Quote:Should an ASSERT_VALID stop in the debugger ? Short answer, yes.It won't tell you directly what led to the assertion, but you should be able to look at the call stack and trace back to see what part of your code led to the assertion being triggered.
22 Apr 2010 by Alexei Shamov
Class to convert .NET classes into readable debug output with less effort
19 Jun 2012 by Ali_100
ZA>Hi Folks,actually i am using VS2003.& im having a debug issue,as snap is attached ,kindly guide me please.ThanksHow can i attached an image?Image
19 Jun 2012 by Ali_100
Hi Folks,We are 4 users having a project on a shared pc,actually the issue is that at a time a user can debug the project if at that time the another user try to degug the error msg is shown ,as snap is attached here,We are using VS 2003,the project is at the remote pcThankz Click...
1 Oct 2013 by Alimjan Yasin
I want to debug a automake c project. and I am doing it with Cygwin in windows.I can compile it correctly, by doing aclocalautomake --add-missingautoreconf./configuremakefor use gdb debugger, I want to generate debug , so I did like..../configure CFALGS=-g3 (or...
2 Oct 2013 by Alimjan Yasin
I found the problem,gbd .lib/slim.exeworked. The debug version is there.
15 Dec 2013 by Allgaeuer
Hello folks,Is it possible to create a full memory dump of a Windows service when it crashes? Obviously, there are the well known postmortem debuggers, which can collect a memory dump of a failing process. But the problem with Windows services is that they are running within the...
22 Nov 2012 by Amit Bezalel
Tackling mananged memory leaks using windbg, profiliers and weakreferencs
14 Jun 2013 by Amit KD
Hello,Host Win7_x64, target VM Win7_x64 both on same physical machine.Driver debugging using VS 2012 (Visual Studio Integrated Windows Debugger.)Able to provisioning between Host and target using VS 2012 and WDK 8.0.KmdfSmall driver given on msdn is properly able to install on...
15 Jun 2013 by Amit KD
Hey Solved! changed the value of Component Filter Mask on target machine where driver has been installed to debug.HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter. Under this key, created a value with the name "IHVDRIVER" and Set the value of this...
30 Jul 2013 by Amogh Natu
I'm using Visual Studio 2008 Professional Edition for development. I have observed that whenever I test web applications or websites using Ctrl+F5 or simply F5 and then stop the debugging (or close the browser), the debugging starts again, as if I pressed Ctrl+F5 or F5 again.Initially I...
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...
1 Jun 2010 by AndreBroz
How to debug DirectShow
17 Sep 2012 by Andres Adhi
I am trying to figure out what is the best way to Debug any SharePoint applications.
1 Aug 2011 by AndrewG1231
I am trying to debug an application and I keep running into this error around the break point:File f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\filelist.cppLine:255What does this error mean? The following is my call stack around the point where a debug assertion error occurs: ...
25 Aug 2011 by AndrewG1231
So,after a lot of guidance from the c++/mfc forum, the answers to the questions here, and Ivor Horton's book on Visual Studio 2010 I was able to solve the error. The error first was being thrown by the return value of E_INVALIDARG for the variable hr in ENSURE(SUCCEEDED(hr)) After stepping...
27 Jan 2010 by Ankur\m/
Hello every1,I developed and deployed a web application using ASP.NET,C# successfully.The application was running perfectly until yesterday.[NOTE: It still works fine on local server (tested using both development server and IIS)]What happens now is:The website opens perfectly. After...
3 Oct 2010 by Anthony Mushrow
Indexing and backing up your debug information files to help debug crashes from out in the wild
8 Aug 2011 by Anthony Mushrow
You might also want to check the project properties.Under 'Configuration Properties -> C/C++ -> Code Generation' Make sure that your Runtime Library isn't set to use the Debug versions when doing a Release build.
3 Jul 2013 by Apriorit Inc, prepa1
This article describes the implementation of a simple tool to deal with debug blocking based on the function execution time
15 Jul 2013 by Apriorit Inc, Kotik Anton
Modern anti-debug techniques - Nanomites and Debug Blocker - are considered for Windows and Linux code
7 Apr 2016 by Apriorit Inc, Kulchytskyi Oleg
Several approaches of anti-debug protection and some tips about how they are usually neutralized by reversers
1 Mar 2019 by Apriorit Inc, Sergii Kusii
4 Mar 2019 by Apriorit Inc, Artem K.
A clear overview on how you can establish communication between a device and its driver
27 Oct 2015 by Are Riff
Microsoft Visual Studio CodeI'm new to programming. I've been practicing for over two months now.I just love VS Code, it's fast to launch to start coding.How can I setting it up to compile or debug my code in it?The settings are all confusing.I also have VS 2015 and MinGW (C:\MinGW)...
24 Oct 2011 by Areff
hi,my problem is in VS2010, i have an enterprise application based on Silverlight and Esri components , i can build or rebuild web project (that hosts silverlight) but when i want to compile and run (F5) it VS crashes and a dialog windows apperas that wants to restart VS.i didnt have not...
30 Mar 2020 by ashriv
I try to debug my web service with IIS7. It doesn't start and throws an error."Unable to start debugging on the web server. The remote debugging components are not registered or running on the web server. Ensure the proper version of msvsmon is running on the remote computer."my...
24 Jun 2013 by ashriv
I did these two things and Issue resolved -1. Enable 32-bit application settings set as True.for this , right click on Application Pool -> Advance Setting -> Enable 32 bit Application -> TRUE2. Assign this Application Pool to my project Virtual directory.There are some other...
27 May 2014 by asmaaelshabaka
my application was worked fine but suddenly it is stop working and give this error [InvalidOperationException: Stack empty.] System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) +52 System.Collections.Generic.Stack`1.Pop() +6694385...
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
29 Oct 2014 by Asutosha
Dear All,I have a web application having both classic asp page and aspx pagesOn start up default.aspx is calling and it is redirecting to home.asp pageI want to debug the asp page in visual studio.Need ur help how to debug the asp page.I will appreciate and thanks for you...
27 Jan 2010 by Avi Berger
I don't know myself, however I located this[^] which might be helpful - particularly the last section on using a kernel debugger.
8 May 2013 by ayesha hassan
My following code is compiled successfully and runs perfectly for sometime handling 40 clients but after sometime, it gives an error "Debug Assertiion Failed expression: (_osfile(fh) & fopen)".I searched on internet and found a solution:Project + Properties, Configuration properties,...
26 Sep 2013 by Azee
Just drag the debugger on the line after your Send Email code. It won't be executed, then press F5 or stop the debugger.Cheers :)
28 Nov 2023 by Babar Ali Nov2023
I have a camera device in device there is button in camera to capture the image I have having a issue when I capture the image with camera device the camera location is not in original size and image is cutting when I click on the form save...
22 Apr 2015 by Bartlomiej Filipek
PDB Was Not Found - Linker Warning
23 Sep 2015 by Bartlomiej Filipek
By default, Visual Studio (up to VS 2013) uses additional debug heap that slows down applications, even in Release mode. Read what you can do about this.
13 Jan 2012 by baruchl
How to setup .NET symbol server and enable production debugging without source code
9 Oct 2014 by beMember
Hello, My site has an image gallery with a row of pictures at the bottom. When I load up the page it should show image 1 in the main gallery window, but instead it's showing image in position #10 (the one to the left of #1). You can see what I'm talking about here[^]When you load the...
4 Sep 2014 by Ben M Watson
Learn how to use the debugger to answer implementation questions for yourself
23 May 2010 by Ben.Regaya.Hedi
Hi all,I have an assembly registred in the GAC of virtual machine WindowServer2003 and I want to know haw can I debug the C# code from VisualStudio 2008. and here I must put the "pdb" file.Thanks
25 May 2010 by Ben.Regaya.Hedi
Hi all,I have created a DLL using VS2008, and I registred this DLL into the GAC to be consumed from Navision as an Automation.the DLL work fine from Navision but I whant to know is it possible to debug the DLL from VS2008 when we run the code from Navision. The DLL is registred into the...
6 Jan 2022 by Bernhard Nebel
Link-time optimization and debugging OO programs do not work very well together, at least on AVR MCUs.
4 Nov 2014 by Bhola S. Parit
I am Working on Windows 8.1 application with Visual Studio 2013 and getting this Error A debugger is attached to .exe but not configured to debug this unhandled exception and application going closed. Please give me solution.
31 Oct 2013 by Bhuvanesh Mohankumar
Hi,I am not so sure about this solution.In Web.Config File, if you take a look there will be two Files under the "Web.Config" category.The sub Files of that Branch will be named as 1.Web.Debug.config2.Web.Release.configIf you are Debugging the File, the Config details will be...
12 Aug 2016 by Bhuvanesh Mohankumar
When start the Debugging of solution using "F5" option, the connection properties pop out and ask to enter the credentials and connection properties for the database server in VS 2015 for MVC - Entity framework application.Can some one help me to stop this pop out.Thanks in...
12 Aug 2016 by Bhuvanesh Mohankumar
I have added the Connection string which connects my local SQL database with the Entity framework and this helped to fix the issue.Add a connection string which points to the local database and modifies the "Integrated Security" type to "false" and provides the valid username and password.
4 Jan 2016 by Bin Chou
I have a 2d Array (float*) with the size 1280*720 for some bitmap process. I want to display it as what I do in matlab. But I found the Memory Window in visual studio has a limit of 512 cols. When I set the num of column in Memory Window biger than 512, it change to 512 automatic. How can I...
16 Dec 2017 by Biswal Tanmaya
This blog post discusses the importance of logging in MySQL
20 Nov 2015 by borchef
This is the introduction to a series of articles about Modulair JavaScript.
11 Jun 2010 by Brian R. Bondy
Sounds like you need a header guard around your definition of `CmdLockMutex` (Add `#pragma once` at the top of its .h file.). Or rather you have a naming conflict.Maybe you have something like this:enum MyEnum { MyEnumVal1, MyEnumVal2 };//....class MyEnum{ };
17 Feb 2013 by bunzitop
I had textbox in my form, i deleted it and inserted new combobox in place of textbox. there are two erros related to combobox but also when i build it message comes BUILD SUCCESS when i run it , runs and shows the deleted text but and doesnt display the newly inserted combobox. i am using...
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...
20 Jan 2023 by Canned Bread
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DebugFixMethods { class Program { static void Main(string[] args) { (new...
20 Jul 2011 by CarolineRafferty
Hi,When I debug a very simple website in Visual Studio 2010 Ultimate edition I get the error "Internet Explorer cannot display the webpage". This only happens if I am in debug mode for more than about 10 seconds. If I press F5 promptly on all the breakpoints I don't get the error, but if I...
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.
26 Aug 2013 by chandanadhikari
hi,How to make ADPlus (version 7) collect dumps for a process after every 15 minutes using custom .cfg file. here is what i already tried in the cfg file(for example interval is 20 seconds) : DumpOnly Hang ...
3 Jul 2015 by chenghuichao
First of all, I can debug one page(like index.php page).what if I have a form in php page, and post to index_script.php page, how can I debug the codes in index_script.php.I'm Php beginner (before .NET), I just put the question here. hope someone can help me.thanks in advanced.
11 Sep 2018 by CHill60
The Microsoft Documentation has an article specifically on the order of events - Order of Events in Windows Forms | Microsoft Docs[^] EDIT after OP comment One way to track the order of events in controls or objects is to log them - you will need to use the IDE to generate the code stub for...
28 Aug 2011 by Chiranthaka Sampath
Hi do you guys know about some software tools such as CASE tools that use to check software bugs within newly build application or web sites. I had read an advertisement in the code-project about such kind of software but now I cannot remember it. So that please inform me about such testing...
1 Nov 2016 by Chris Losinger
uni = temp.substr(start,j-start-1);looks like a potential out-of-bounds.if j==0, this will be temp.substr(0, -1);
1 Nov 2016 by Chris Losinger
compiling and running the code, and giving it "this is a line" as input, the code asserts on cout
11 Jun 2010 by Chris Meech
I have a call to MAPILogonEx that is throwing an exception.First-chance exception at 0x2038325f in FileMail.exe: 0xC0000005: Access violation reading location 0x2038325f.The documentation[^] doesn't mention anything and since it is an access violation, I expect that I have some kind of...
15 Jan 2011 by chris4562
I have created a program which uses a dll as its main system, in which I have created a debug system which reports to a file or sdtout or both.but for a release version I wish to use a seperate application to use as a console for receiving the debug trace.I want it to be independant of...
21 Mar 2010 by Christian Graus
Perhaps you should just read the error messages and look at what they say ? Perhaps also if you want to ask a programming question, you should tell us what the errors are, show us the code, and even tell us what language you're using ?
11 Jun 2010 by Christian Graus
You've defined CmdLockMutex more than once. Perhaps you've got an issue with your #include files ? Is this an MFC class and you've not got MFC linked to your console app ? Hard to say more without seeing code.
28 Jul 2010 by Christian Graus
Copying and pasting your homework to this website is not the same as study, and it sure is not the same as learning. Your teacher is sure to know how to use google, so if you think he can identify you from your username, you should go and talk to him before he talks to you, or perhaps doesn't...
28 Oct 2015 by Christoffer Nilsson
So I've made a software, I debugged it & it created a Exe when I press it in the folder it works fine, if I move the exe outisde the folder it says the program has stopped working, if I create a folder and add the two dll files with the exe it works, how to I merge those 3 items together or how...
28 Oct 2015 by Christoffer Nilsson
Thank you Phil.o for the answer!
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...
12 Sep 2016 by Coder Block
I am currently developing some addition code as dll for one third party executable. For debug of my DLL using third party exe, I am providing executable path in debugging property. Project propertyAll things are working properly unless they release new version of executable. They...
18 Jun 2022 by coderlearner
#include #include using namespace std; class student { int id; float t1,t2,t3; char name[50]; public: student() { } student(int a,int b,int c) { t1=a; t2=b; t3=c; } student(student &t ) { t1=t.t1; t2=t.t2; t3=t.t3;...