Simple C# Threading and Thread Safety

A few days ago I compared and contrasted Asynchronous and Parallel Programming. Today I would like to walk you through a very simple threading example in C#, and why the concept of “thread safety” is important to know before you start writing parallel applications.

Read More
C# Preprocessor Directives

If you have ever worked with an application that bounces from your workstation, to QA, then to production the odds are high you have dealt with C# preprocessor directives. While C# does not have a preprocessing engine, these directives are treated as such. They have been named as such to be consistent with C and C++ for familiarity. Directives can be used to build classes based on the environment they will be deployed in, to grouping chunks of your source code together for collapsing inside the Visual Studio code editor. This article will go over each C# preprocessor directive.

Read More
Asynchronous Versus Parallel Programming

The last decade has brought about the age of multi-core processors to many homes and businesses around the globe. In fact, you would be more hard-pressed to find a computer with no multi-core (either physical, or virtual) support for sale on the market today. Software Engineers and Architects have already started designing and developing applications that use multiple cores. This leads to extended use of Asynchronous and Parallel programming patterns and techniques.

Read More
Follow Up on IIS Services, 504s, and Fiddler

The other day I posted an article discussing my issue tracking down a bug in a ClickOnce application. I had noted that once I made a change to maxRequestLength in my web.config file the issue went away. Well, that change was not the real solution.

Read More
IIS Services, 504s, and Fiddler

I have been tracking a random issue in one of our projects here at Mercer. It is a simple ClickOnce application, with a handful of hosted services through an IIS website. When I worked on the tool in my local development environment everything worked fine. When I deployed the tool to QA for testing it completely broke at a single point in the application for our QA team in India. The tool worked fine here in Louisville, with the exception of this morning where I was able to reproduce the problem.

Read More
Specialized C# Operators

In a previous post I went over some random C# operators. This article is a follow-up to that one, covering some more advanced C# operators and techniques. Specifically, the ?: operator, the ~ operator, |= operator, and the ^= operator.

Read More
IronPython and C#

So the other day I wrote about dynamic types in C#. I covered a few use cases from COM interaction to working with other languages. Well, today I have put together an example for you that will load a Python file into C#, through IronPython.

Read More
Dynamic Types in C#

When C# 4.0 was released, it added a new type for variables called dynamic. The dynamic type is a static type, but it is an object that bypasses static type checking. Now if your head has just exploded from reading that last sentence I apologize. When you compile an application that contains any dynamic types, those dynamic objects are assumed to support any operation that may be ran against them. This allows a developer to not worry about where a method is coming from be it XML, DOM, or other dynamic languages like IronPython. However, if at runtime a method or command does not exist errors will be thrown at run-time instead.

Read More
Understanding Path Limits in TFS

Team Foundation Server (TFS) is bound to a some limitations that can potentially break your Visual Studio project. One of these limitations is the character count limit in a file path. If you overshoot this limit you will run into issue when adding new files to TFS or attempting to compile your project in Visual Studio. Here is a quick overview explaining why TFS behaves like this and what you can do about it.

Read More
Random C# Tricks

I wanted to share a few C# tricks I reviewed today. Some programmers will use them all the time, others barely know about their existence.

Read More