2

In short, what are the steps that one needs to take in order to modify the source of the connector and install it in Windows?

I have the MySQL Connector/.NET Version 6.1.2 installed on my machine, but I'm getting an exception for every DateTime with a value of '0000-00-00'. This exception breaks my application.

As I solution, I downloaded the source code for the connector and changed the exception so that instead of throwing an exception, it returns the date '0001-01-01 00:00:00'. Although I was able to modify the code and even compile the DLL (NOTE: I commented out the Assembly reference to ConnectorNet), I can't figure out how to install the dll onto my computer. Apparently I'm not able to simply replace the DLL in the Global Assembly Cache because my custom DLL is not strongly typed.

In sum, what are the steps that one needs to take in order to modify the source of the connector and install it in Windows?

Thanks.

Ben McCormack
  • 32,086
  • 48
  • 148
  • 223
  • I am in the same boat as you were here. There is a fundamental flaw in the mysql connector. It fails to produce unique names in complex queries. I have downloaded the open source, and have edited what I think the change should be but am having trouble building. Were you ever able to properly modify and deploy the modified `.dll`? – Travis J Oct 17 '12 at 21:01
  • @Travis Let's see, it's been 3 years, so my memory on this is really fuzzy. I think I was able to build it in the end. I think I ended up downloading MonoDevelop and opening the solution in that tool. I may have needed to remove the property of the project/solution that makes it a signed assembly. I probably removed something from the assembly properties. In the end, if this is only for personal use, it's fine not to sign the assemblies. Otherwise, you would need to submit a patch to the MySQL Connector project (how?) and get the change included upstream. – Ben McCormack Oct 18 '12 at 15:48
  • I actually ended up doing just that. You can see a mini tutorial / Q&A I posted here: http://stackoverflow.com/q/12944570/1026459 . I could not get around signing it either, although I did find a workaround it seemed over top because as you point out, why sign it if you are only going to use it locally/personally. I submitted a bug report, but more than likely it will not be seen until 2015. Thanks for your response. – Travis J Oct 18 '12 at 17:08

2 Answers2

1

You need the original Private key.

Assemblies in the GAC have a 'strong name', and an encrypted hash is part of that.

Only the owner of the private key can create an assembly with the same public keytoken (digital signature).

You either need the key-pair (a .snk or .pfx file) to sign your new DLL or you will have to recompile the applications that use the DLL.

H H
  • 263,252
  • 30
  • 330
  • 514
1

It's not really recommended you update the .NET connector. A better reason would be to find out why the exception is getting thrown.

If you're getting exceptions when trying to insert a date of 0000-00-00, consider disabling the MySQL's server's NO_ZERO_DATE server mode option.

Powerlord
  • 87,612
  • 17
  • 125
  • 175
  • I understand that it may not be a best practice to update the .NET Connector. However, the exception is happening in the connector and I may not have the ability or access to update the database to remove invalid dates. – Ben McCormack Oct 15 '09 at 20:22