Why is the C# compiler lying to me?

Tuesday, 29 March 2011

Today I spent over half an hour trying to figure out why the C# compiler was convinced I had a syntax error while I was convinced I didn't. Of course the compiler was right, but it lied a little, sort of...

Check out this code. Looks fine right? Apparently not.

Typo1.png

Checked all my braces matched up, even commented out large chunks of the code until I finally noticed this when I scrolled right a little:

Typo2.png

Doh! Lesson: next time the compiler is talking nonsense... scroll right.

(and by the way I deliberately removed the random salting of the password hash before taking the screen shots).

« PetaPoco - T4 Template support for SQL Server Showcase Lane Reinvented »

Leave a comment

Name (required)
Email (required, not shown, for gravatar)
Website (optional)
Your Message
Leave these blank: