Contents tagged with C#
-
When Not-True Doesn’t Equal False
There is a strangely common, reoccurring bug I’ve seen return, again and again, in most projects I’ve worked on in recent years. I call it the “Not True != False” bug, and it crops up, usually, when … more
-
Not-So-Lazy Static Constructors in C# 4.0
A coworker pointed me towards an interesting blog post by John Skeet about the changed behavior of static constructors in C# 4.0 (yes, I know, it’s been a few years now, but I never ran into it). It … more
-
ArcGIS–Getting the Legend Labels out
Working with ESRI’s ArcGIS package, especially the WPF API, can be confusing. There’s the REST API, the SOAP APIs, and the WPF classes themselves, which expose some web service calls and information, … more
-
The Case of the Unexpected Expected Exception
“NUnit is being problematic again”, they told me when I came to visit the project. “When running unattended it’s not catching assertions properly and the test is coming up green, but when stepping … more
-
Moq, Callbacks and Out parameters: a particularly tricky edge case
In my current project we’re using Moq as our mocking framework for unit testing. It’s a very nice package – very simple, very intuitive for someone who has his wrapped around basic mocking concepts, … more
-
Static Constructor throws the same exception again and again
Here’s a little gotcha I ran into today – if you have code in a class’s static constructor that throws an exception, we will get a TypeInitializationException with the original exception as the … more
-
Upgrading all projects to .NET 3.5
A simple macro to change the Target Framework for a project from .NET 2.0 to .NET 3.5, hacked together in a few minutes. This will fail for C++/CLI projects, and possibly VB.NET projects (haven't … more
-
System.Diagnostics.EventLogEntry and the non-equal Equals.
Just a quick heads-up in case you're stumped with this problem, or just passing by: The System.Diagnostics.EventLogEntry class implements the Equals method to check if two entries are identical, even … more
-
Displaying live log file contents
I'm writing some benchmarking code, which involves a Console application calling a COM+ hosted process and measuring performance. I want to constantly display results on my active console, but since … more
-
Another minor C#/C++ difference - adding existing files
Another minor detail that bit me for a few minutes today. I'm posting this so I'll see it and remember, and possibly lodge it in other people's consciousness. Using Visual Studio 2005, adding an … more