How to investigate Rebuilding in Visual Studio when nothing has changed

In some managed projects there’s this unfortunate behavior: you press F5 in VS, run your app, stop, then press F5 again and it says “Building…”. Why is it building when nothing has changed? Or you change something in one project and multiple seemingly independent projects are being rebuilt as a result. This slows you down,…

7

Get most duplicated strings from a heap dump using ClrMD

ClrMD is an awesome managed API to inspect managed processes and dump files. To use it, just add a NuGet reference to Microsoft.Diagnostics.Runtime. When loading a dump, be sure to have the mscordacwks.dll from the machine where the dump was taken. Also make sure that your program that uses ClrMD is the same platform (32/64-bit)…

0

sn.exe cheat sheet

I don’t find sn.exe command line arguments particularly intuitive, and the fact they’re case sensitive doesn’t exactly put you in the pit of success either. Also, it turns out there are two kinds of .snk files. One kind is 596 bytes by default and contains a key pair (private and public key). The other kind…

1

Creating an instance of an open generic type without specifying a type argument

My fellow Roslyn tester @vreshetnikov has found not one, but two ways to do the impossible: 1: using System; class Program {     static void Main()     {         var open = Enum.ToObject(typeof(C<>.E), 0);         Console.WriteLine(open.GetType());     } } class C<T> {     public enum E { } } 2: using System; class Program {     static void Main()     {         Action<C<int>.E> a = M;         var open = a.Method.GetGenericMethodDefinition().GetParameters()[0].DefaultValue;         Console.WriteLine(open.GetType());     }     static void M<T>(C<T>.E e = 0) { } } class C<T> {     public enum E { } }

5

Saving Regedit Favorites in a .reg file

Regedit.exe has a useful feature – Favorites menu, you can add an often used registry location to favorites to quickly expand to it in the tree view. But did you know that favorites themselves are stored in registry and so you can have a RegeditFavorites.reg that you run to quickly fill the Favorites menu with…

2