Bug #75673 The type initializer for 'HtmlRenderer.Utils.FontsUtils' threw an exception
Submitted: 29 Jan 2015 6:43 Modified: 29 Jan 2015 14:10
Reporter: Han Chen Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S1 (Critical)
Version:6.2 CE OS:Windows (Windows 10 Pro Technical Preview Evaluation copy. Build 9926)
Assigned to: CPU Architecture:Any
Tags: FontsUtils, workbench

[29 Jan 2015 6:43] Han Chen
Description:
After I installed MySQL Workbench by MySQL installer, I launched the workbench main interface successfully. However when I tried to click the "Local instance MySQL56" and it popped up a Unexpected Error window said "The type initializer for 'HtmlRenderer.Utils.FontsUtils' threw an exception." and asking me to report this bug to you to fix it. The first time I tried to click "Close" of this error window and trying to click the "Local instance MySQL56" again but nothing happened. I tried other options on main interface, most of them worked fine (Sorry I didn't have time to try everything out). I tried to click the plus button above  "Local instance MySQL56" box which is right behind "MySQL Connections" tittle. In that window I clicked "Configure Server Management..." button and following the guide I saw it said connection testing was done and everything was OK.

How to repeat:
You can try to go through it again as what I said in "Description"

Suggested fix:
I guess the problem is from the font util since the tittle of exception looks like it is. Therefore I will try to re-install MySQL Server to see whether there is any option relating to font util and I will choose it carefully.
[29 Jan 2015 11:19] MySQL Verification Team
Thank you for the bug report. We don't have noticed this issue with Windows 8.1 and older so please report this issue the issue with Microsoft about Windows 10. Thanks.
[29 Jan 2015 13:12] MySQL Verification Team
Sorry it was already reported: http://bugs.mysql.com/bug.php?id=75344.
[29 Jan 2015 14:10] Han Chen
I received the email. Thank you for replying me. According to the link you sent to me, I realized that another user who has same problem is using windows 8.1. Actually I was thinking to revert my windows 10 to 8 to solve this problem but I don't think it will work now. Anyway, thanks for tracking my report. I hope you guys can fix it ASAP.
[28 Apr 2015 9:01] Michael Gaillez
The problem is in the ArthurHub HTMLRenderer (https://github.com/ArthurHub/HTML-Renderer). In the FontsUtils class replace

static FontsUtils()
        {
            _fontsMapping["monospace"] = "Courier New";
            _fontsMapping["Helvetica"] = "Arial";

            foreach (var family in FontFamily.Families)
            {
                _existingFontFamilies.Add(family.Name, family);
            }
        }

With:
static FontsUtils()
        {
            _fontsMapping["monospace"] = "Courier New";
            _fontsMapping["Helvetica"] = "Arial";

            foreach (var family in FontFamily.Families)
            {
                if (!_existingFontFamilies.ContainsKey(family.Name))
                {
                    _existingFontFamilies.Add(family.Name, family);
                }
            }
        }

Recompile the dotnet library and replace in the workbench folder and enjoy :-)!
[15 May 2015 0:12] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=77039 marked as duplicate of this one.
[18 May 2015 12:21] Igna Heyns
" [28 Apr 9:01] Michael Gaillez

The problem is in the ArthurHub HTMLRenderer (https://github.com/ArthurHub/HTML-Renderer). In the FontsUtils class replace"

I have the same problem in Windows 10 tech preview 10074 with workbench 6.3.3.

The FontsUtils class is not available in the Master or v1.5 branch as stated by Michael Gaillez? Where did you find it?
[22 May 2015 15:44] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=77104 marked as duplicate of this one.
[1 Jun 2015 22:59] Ryan Williams
If you go to codeplex and get the 1.4.14 version download that 
https://htmlrenderer.codeplex.com/releases/view/100328

open up the project and then do a search for 
static FontsUtils()
replace the code with what Michael Gaillez suggested
change the assembly version to 1.4.6 instead of 1.4.14 so that mysql workbench doesn't complain. 
Compile and rename/replace HtmlRenderer.dll in program files>mysql> [your workbench folder]>

After doing that it worked perfect in win 10.
Hope this helps someone, since this has been a bug since reported in jan...
[9 Jun 2015 10:56] Igna Heyns
Thank you!

This solves the problem!
[21 Jun 2015 18:49] Frank Quintero
If someone has a copy of recompiled dll. That would be very helpful to me.
[21 Jun 2015 19:59] Frank Quintero
Here it is! recompiled with the fix!

Attachment: HtmlRenderer.dll (application/x-msdownload, text), 237.00 KiB.

[1 Jul 2015 13:03] Luka Pribanić
I can confirm that a fixed "HtmlRenderer.dll" posted by Frank Quinteroon 21 Jun 2015 used with MySQL Workbench v.6.3.4.0 (build 828) is the first GA version after 6.0.9 that works for me on Windows 10. Thank you Frank! Hope this gets pushed to official v6.3.5 or whatever is the next GA / public build.

Tested with:
Windows 10 Pro, Insider Preview, build 10159 (latest as of today)

Previous non-working Workbench builds that I've tested include at least:
- 6.1.7
- 6.2.5
- 6.3.3
- 6.3.4
- (and any interim builds I may have got my hands on at least since end of March 2015, though I did not take a note of all versions)
These include both 32bit and 64bit versions, and install and non-install ZIP versions.

I've also tested this bug with literally all public Windows 10 builds in the same timeframe.

Again, thank you for the fix, and hope that next GA I download has this fix build in :)
[29 Jul 2015 21:08] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=77876 marked as duplicate of this one.
[30 Jul 2015 13:50] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=77882 marked as duplicate of this one.
[30 Jul 2015 18:01] MySQL Verification Team
bugs.mysql.com/bug.php?id=77890 marked as duplicate of this one.
[31 Jul 2015 0:28] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=77896 marked as duplicate of this one.
[31 Jul 2015 0:30] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=77892 marked as duplicate of this one.
[3 Aug 2015 13:28] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=77915 marked as duplicate of this one.
[4 Aug 2015 4:31] Erik Noyes
Confirming that the compiled .dll replacement has saved the day. Windows 10 Home and MySQL Workbench 6.3.4.0 build 828 (64-bit) can co-exist with the fix. Thanks to the man of the hour for the compiled .dll
[4 Aug 2015 4:35] MySQL Verification Team
Bug #77925 marked as duplicate of this
[4 Aug 2015 11:34] MySQL Verification Team
Bug #77931 marked as duplicate of this
[4 Aug 2015 12:05] Rene Barto
Have also verified that the fix works. Thanks guys!
[5 Aug 2015 3:57] MySQL Verification Team
Bug #77936 marked as duplicate of this
[5 Aug 2015 8:40] MySQL Verification Team
Bug #77943 marked as duplicate of this
[7 Aug 2015 6:12] MySQL Verification Team
Bug #77971 marked as duplicate of this
[7 Aug 2015 6:12] MySQL Verification Team
Bug #77970 marked as duplicate of this
[7 Aug 2015 12:27] MySQL Verification Team
Bug #77981 marked as duplicate of this
[7 Aug 2015 12:37] Luka Pribanić
@Miguel Solorzano & @Umesh Umesh
Sorry to rant, but my OCD is stronger... Why are all these tagged as duplicate of THIS bug #75673, when this very bug is already marked as duplicate of another bug #75344 ( https://bugs.mysql.com/bug.php?id=75344 )
[28 Aug 2015 10:39] Lucas Gabule
Thanks mate it Works XD
[23 Sep 2015 22:51] Ricardo Perez
this solution solved my issue. Thanks for posting the link to the compiled dll
[25 Sep 2015 0:32] Andrew Nash
Thank you! I am working with Windows 10 and running version 6.3 Community of Workbench. The solution under the files tab worked for me. I downloaded the file and replaced the same file in Workbench with the one under the "Files" tab of this website. Thank you very much for this fix. Hopefully they incorporate this fix into Workbench itself. Thank you once again!

PS: The comments section tab of this website was too technical for me to understand how to open the file project and edit it manually. You may want to clarify this for others. In any event, the "Files" tab provided the solution for me. Thank you very much!
[26 Oct 2015 6:51] Pankaj Chhawani
Thank you @Ryan Williams and @Frank Quintero. My SQL Workbench started working fine after the fix suggested by you guys.
[19 Nov 2015 3:47] James Stewart
[21 Jun 19:59] Frank Quintero <--- Thank You.
Fixed my error.  The initial install of Workbench 6.3 v6.3.4.0 build 828 (64 bits) worked fine on my New Dell Laptop (Inspiron 15) until I install some HelveticaNeueLTStd fonts for InDesign.
Downloaded the .dll and now it works fine.
[5 Mar 2017 3:23] Jerome Greene
I downloaded the HtmlRenderer.dll that was talked about on [21 Jun 2015 19:59] Frank Quintero I received the following error message when I tried to open workbench:
could not load type 'system.windows.forms.htmlLabels' from assembly 'HtmlRenderer, version=1.4.14.0,culture=neutral,publickey token=null'

I just upgraded from vista to windows10 never had this problem in vista
still have the old HtmlRenderer.dll that came with download 

is this HtmlRenderer.dll version specific? I am running workbench 6.0 and I see this version is for 6.2

Thanks
[16 Mar 2017 4:15] Raghuvaran Nagarajan
Frank Quintero ---> Thanks! The workbench is working after the fix
[22 Nov 2018 3:12] Flower Wang
it is working! Thank you very much!
[13 Jun 2021 16:38] MySQL Verification Team
https://bugs.mysql.com/bug.php?id=103995 marked as duplicate of this one.