This is a strange case. I am setting the connection in my db context constructor.
Database.Connection.ConnectionString = "server=myserver,55555;Initial Catalog=mycatalog;User id=myuser;Password=myuserspassword;"
This is failing with the Format of the initialization string does not conform to specification starting at index 0.
What is strange is that if I change the code to run the same command a second time, it succeeds on the second attempt.
var constr = "server=myserver,55555;Initial Catalog=mycatalog;User id=myuser;Password=myuserspassword;";
try
{
Database.Connection.ConnectionString = constr;
}
catch
{
Database.Connection.ConnectionString = constr;
}
So it seems the string is ok right? I verified that by screwing up the string and then it consistently throws the format error on all attempts. So it seems that something is causing it to throw the error only the first time I attempt to set the string.
UPDATE: When I hover over Database.Connection before even setting the connection string the error is already sitting there and I can't inspect the Connection property. If I mouse away and mouse back over it then the error is gone and it takes my string on the first attempt. So it seems like that error is being caused before I even get the constructor for the db context. Doesn't really answer the question, but its a clue.
What could that be?