c# – sgen.exe fails during build – Stack Overflow

After adding a new 3rd party reference to a project and then building for Release configuration I got this error (not present when in debug build):
Error Could not load file or assembly ‘x’ or one of its dependencies. The system cannot find the file specified. SGEN  

Here is a solution that worked for me:

If you are having this problem while building your VS.NET project in Release mode here is the solution: Go to the project properties and click on the Build tab and set the value of the “Generate Serialization Assembly” dropdown to “Off”. Sgen.exe is “The XML Serializer Generator creates an XML serialization assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types.” (MSDN)

Source: c# – sgen.exe fails during build – Stack Overflow

BenchmarkDotNet

Benchmarking is really hard (especially microbenchmarking), you can easily make a mistake during performance measurements. BenchmarkDotNet will protect you from the common pitfalls (even for experienced developers) because it does all the dirty work for you: it generates an isolated project per each benchmark method, does several launches of this project, run multiple iterations of the method (include warm-up), and so on. Usually, you even shouldn’t care about a number of iterations because BenchmarkDotNet chooses it automatically to achieve the requested level of precision.

Source: Home – BenchmarkDotNet Documentation

LiteDB – A .NET NoSQL Document Store in a single data file – CodeProject

A simple, fast and free embedded .NET NoSQL Document Store in a single data file. Inspired on MongoDB, supports collections, POCO classes, Bson Documents, indexes, stream data, ACID transactions and LINQ expressions.

Introduction

This article is an overview about my database project LiteDB – a small, fast and free embedded .NET NoSQL Document Store for .NET in a single datafile – and now it’s on new version 2.0

Source: LiteDB – A .NET NoSQL Document Store in a single data file – CodeProject

Js string endsWith() polyfill and other string functions

When you are a C# developer and want javascript to be more like C#:

if (!String.prototype.endsWith) {
    String.prototype.endsWith = function(searchString, position) {
        var subjectString = this.toString();
        if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
            position = subjectString.length;
        }
        position -= searchString.length;
        var lastIndex = subjectString.lastIndexOf(searchString, position);
        return lastIndex !== -1 && lastIndex === position;
    };
}

From: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith

Other good ones:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes

EPPlus – C# .NET library for creating and reading Excel 2007/2010 files

Creating Reports in Excel 2007 using EPPlus (Header, Footer, Comments, Image, Formatting, Shape and Formula)

 Introduction
EPPlus is really a powerful tool to generate excel based reports on server side and it is becoming my favorite tool as I am getting more experienced with it. Previously I wrote a post about Creating advanced Excel 2007 Reports on Server. This post is update on the last post and I am sharing more advanced feature of EP Plus.

Source: Zeeshan Umar’s Blog

C# Interactive Window · Wiki doc

The C# Interactive Window provides a fast and iterative way to learn APIs, experiment with code snippets, and test methods by giving immediate feedback on what an expression will return or what an API call does.

The C# Interactive Window is a read-eval-print-loop (REPL) with advanced editor support. It supports features like IntelliSense as well as the ability to redefine functions & classes. After entering a code snippet–which can contain class and function definitions at top-level along with statements–the code executes directly. This means you no longer need to open a project, define a namespace, define a Main method, add a Console.WriteLine() call to output your result, and add a Console.ReadLine() call in order to play with code. In other words, say goodbye to ConsoleApp137 or whatever ridiculously high number your Console Apps default to today!

Source: Interactive Window · dotnet/roslyn Wiki · GitHub

Unit testing faked async methods

With the addition of the async/await keywords in .NET Framework 4.5, many more methods will now return Task<TResult>.  For example, a web service method can now be created to return Task<TResult> so it is ready for the async/await keywords.  This brings up the question on how you can unit test these methods.

Read more: http://www.intertech.com/Blog/creating-a-task-with-a-known-result/#ixzz3xSNIAWB7