This post is for my own reference, just to avoid this in the future. It happened to my twice already.
I was trying to add a new in-memory databse (Add New Item ? SQL Server Database) within visual studio to quickly knock some prototype and was constantly greeted with this error message.
“Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance”
After a bit of digging and binging, the solution is to delete the SQL express folder completely founder under the user directory
C:Documents and Settings<<your login>>Local SettingsApplication DataMicrosoftMicrosoft SQL Server DataSQLEXPRESS
Then, you may be greeted with Timeout error, but try again. It will be ok second time.