One of the things I wanted to add to MceFM was to let users tell Last.fm to Love/Ban songs.

I was using the RegisterRawInputDevices Windows call to listen for events generated by the remote control.  This takes a RAWINPUTDEVICE structure as a parameter:

    [</span>StructLayout(LayoutKind.Sequential)]
    internal struct RAWINPUTHEADER {
      [MarshalAs(UnmanagedType.U4)] public int dwType;
      [MarshalAs(UnmanagedType.U4)] public int dwSize;
      public IntPtr hDevice;
      [MarshalAs(UnmanagedType.U4)] public int wParam;
    }
</pre>

My code was working fine, and then suddenly stopped working.  I lost at least an hour tracking back what I'd changed recently, and then finally realized that I'd run Resharper's Reformat Code tool:

image

Notice that last item?  This is what it did to the structure:

    [</span>StructLayout(LayoutKind.Sequential)]
    internal struct RAWINPUTHEADER {
      [MarshalAs(UnmanagedType.U4)] public int dwSize;
      [MarshalAs(UnmanagedType.U4)] public int dwType;
      public IntPtr hDevice;
      [MarshalAs(UnmanagedType.U4)] public int wParam;
    }
</pre>

</span>The RegisterRawInputDevices call was falling over because the structure was totally out of whack.  I'm still a big fan of Resharper -- and this is marked as fixed in the next release.