My .csproj file contained a line of type EmbeddedResource. Since the library does not have support for this type, the enumeration of Contents instantly throws an error "Item not found in Dictionary". This could be solved by adding a class EmbeddedResource but more unsupported types can come up.