I ran into a very strange problem yesterday. My program had an error in it that appeared only when I ran the exe from the project release folder, and not when I ran without debugging (or with debugging) in-compiler. It wasn’t a terrible, terrible problem; my program still ran. It was just that every so often, when a player fired a projectile, the projectile would be assigned the ID number 1952870259. This exact number, every time. However, it was a very peculiar problem, in that even when running a debug version of the exe from folder, the problem did not manifest. That meant I couldn’t debug the solution using Visual Studio, and that didn’t go over well with me. I went over and over my project properties to no avail, even creating a new project within the same solution, copying over all files from the server into the new project and not importing any project settings. The problem was still there.
Of course, at this point I concluded it had to be a problem in my code; I’d created a new project and copied over all the files. The only variable left was my code. So, I began debugging without the debugger, and eventually I came to the conclusion (hours later) that the problem only occured when a projectile hit a wall. No big deal. I went to that block of code, and I found… Nothing.
Argh.
At this point, I was frustrated beyond belief by this and other problems occurring in my life, so I took a break and played some Heroes of Newerth with friends. Won some, lost some, I’m sure you know how it is. Today, I went back and copied all code to a new solution and ran the program in debug mode just to make sure it compiled. After fixing some problems I forgot were inherent in starting a new project with Dark GDK, I ran the program, shot a projectile at a wall and BLAM, runtime error.
W T F. This didn’t happen in my other solution. I went through and fixed the error. It was very simple, a list iterator was going out of bounds and pointing to nothing; thus, the ID that was being assigned to the projectiles was some random number gotten by the program from null memory. But that still didn’t answer the question of WHY. Why did my program only throw the runtime error when I had created a new solution? Who the hell cares, right? I’d gotten my program to work. But this experience just goes to show how reliant I am on the Visual Studio debugger.