C# & MySQL Connector: Guid should contain 32 digits with 4 dashes

I encountered the following error when using the MySQL-Connector in mono (or .NET if you prefer Windows) when issuing select statements:

Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

That error comes from the MySQL-Connector. Everything that is CHAR(36) in your database will be parsed as GUID in .NET. If there is something as “, null or something that cannot be parsed as GUID the connector throws an Exception.

See https://bugs.mysql.com/bug.php?id=60945

We chose to declare char(36) as always containing guids. If your column 
can contain nulls, I suggest you use NULL instead of '' to represent that. 
If the column is not containing guids, then use char(37) or some other length.

Altering the table-schema was not a option I could consider. But there are some connection-string-options for the rescue. See http://dev.mysql.com/doc/connector-net/en/connector-net-connection-options.html for details.

Long story short: add the following to your connection-string to parse CHAR(36) as System.String and not as GUID:

old guids=true;

Here is an example MySQL.NET connection String:

server=localhost;user=root;password=abc123;database=test;old guids=true;

By using this, CHAR(36) will be converted as System.String. No exception will be thrown if the database value is not a guid but really something else as your application coincidentally uses CHAR(36) for something else than GUIDs.