filmov
tv
How to Debug C# Programs #1: NullReferenceException, Histacom BIOS mock-up

Показать описание
Hey guys! I'm going to be starting a bit of a mini-series where I show you guys how to debug and fix C# programs and the various crashes you'll get when something goes wrong.
What better thing to start off with than a NullReferenceException in the code of a Packard Bell BIOS mock-up by my friend Richie? This one is a simple one, but it'll show you how I use the call stack and Locals window to find out where in the .NET Framework the exception was thrown and what variable reference was null. Based on those findings, I can very easily figure out what the actual bug is.
In this case, an attempt was made to set the Font property of an uninitialized Label variable.
Music by Anders Enger Jensen
What better thing to start off with than a NullReferenceException in the code of a Packard Bell BIOS mock-up by my friend Richie? This one is a simple one, but it'll show you how I use the call stack and Locals window to find out where in the .NET Framework the exception was thrown and what variable reference was null. Based on those findings, I can very easily figure out what the actual bug is.
In this case, an attempt was made to set the Font property of an uninitialized Label variable.
Music by Anders Enger Jensen