Category Archives: C#

Span in .NET, C# and other languages

By now probably most .NET developers have heard about the new Span classes, that will be added in the upcoming .NET and C# versions (C# 7.2 to be more precise). I won’t go into details about what it is and … Continue reading

Posted in .NET, C#, Uncategorized | Tagged , , , | Leave a comment

NameOf and Obfuscators

I was wondering some time ago how the new ‘nameof‘ operator from C# 6.0 works when using .. obfuscators. Let’s write some code to verify this. I included a few other methods to get the member name (VS2015 RC was … Continue reading

Posted in .NET, C# | Tagged , | 1 Comment

On closures and captured variables

A few days ago, on the project I’m working on, I’ve stumbled on an interesting bug – an example of why it pays off to learn the ‘deeper’ areas of C# language (or any other language). Greatly simplified (and with … Continue reading

Posted in .NET, C# | Tagged , , , | Leave a comment

On assumptions and formats

In .NET (and any other framework for that matter), it’s better to never assume anything, but to check twice. Let’s take an example – what do you think, will the following unit test always pass? . . . . . … Continue reading

Posted in .NET, C# | Tagged , , , | Leave a comment

On confusing error messages

This morning I stumbled upon a strange error message, while running a .NET console application: The application has failed to start because its side-by-side configuration is in correct. Please see the application event log or use the command-line sxstrace.e xe … Continue reading

Posted in .NET, C# | Tagged , , , | Leave a comment

ADO.NET connection resiliency

In a previous post I mentioned a new feature that was going to be added in .NET Framework 4.5.1: ‘ADO.NET connection resiliency’. Now that .NET 4.5.1 is RTM, I decided to check what exactly is this all about.I wrote a … Continue reading

Posted in .NET, C# | Tagged , , , | 3 Comments

Some multi-threading gotchas

Most programmers know that they must make their code thread-safe when accessing shared data from multiple threads at the same time. However, there are some cases which are not so obvious and which might cause very subtle bugs that appear … Continue reading

Posted in .NET, C# | Tagged , , | Leave a comment

Event aggregator in .NET

A few days ago I had to choose an event aggregator implementation for using it inside the project (ASP.NET in this case). Of course, there are plenty of alternatives, probably the most famous being the one from Prism . Since that … Continue reading

Posted in .NET, C# | Tagged , , , , , , , , | Leave a comment

MSTest and continous integration without Visual Studio

I recently had to setup a CI server (Jenkins, but this applies to any other, like CC.Net or TFS) and had to automate the execution of unit tests after each build. The project uses MSTest and everywhere I searched it … Continue reading

Posted in .NET, C# | Tagged , , , , | 1 Comment

Optimistic concurrency support in HTTP and WebAPI – part 2

A short follow-up to the latest post on Optimistic concurrency control in ASP.NET WebAPI. One question that might come up is: what should we do if, after changing a resource (entity), the client send a PUT request with the changes, but forgets … Continue reading

Posted in .NET, C#, Web | Tagged , , , , , | 2 Comments