In a RavenDB ASP.NET MVC app I was recently working on, I was constantly seeing good ol’ System.FormatException – “Input string was not in a correct format”.
My entities all use ints for their Ids.
After a while I noticed (via the RavenDB Management Console) that my entities had Ids like “tab/123”, but previously the Ids were like “tab-123”.
The problem turned out to be that I had accidentally removed this line while doing some refactoring:
documentStore.Conventions.IdentityPartsSeparator = "-";
Once I put that back in I stopped seeing the System.FormatException and all was right in the world.
Unit tests save you the pain of trying to figure out where you broke something, by breaking first.
TDD FTW