The TinyMCESettings object has NULL objects in the ToolbarRows collection

Deane Barker
Member since: 2008
 

I've upgraded from 6r2 to 7, and have encountered a really difficult bug.  Whenever I do anything that requires TinyMCE to be instatiated, I get a null reference error.  I have decompiled, and debugged through the decompilation, and I've isolated it down to this:

The TinyMCESettings object has a "ToolbarRows" property.  This property is a collection of "ToolbarRow" objects.  For some reason, the elements in the collection are NULL.

I have definitively proven this with two different breakpoints in the EPiServer.dll assembly (thanks .Net Reflector!).  Here's the output from the Immediate window in one case:

Settings.ToolbarRows

Count = 2
[0]: null
[1]: null

In another case, I saw the same thing, except there was only one item (the settings for that property only had one row of buttons on TinyMCE, so it fits).

Obviously, any code which tries to reference this will die.  Code like this, for instance.

foreach (ToolbarRow row in this.Settings.ToolbarRows)

In one property, I had custom settings.  In the other, I had EPiServer's default settings -- I hadn't touched the TinyMCE buttons.

This is deep, deep down inside EPiServer's DLLs.  Can anyone tell me why this is happening?

#64169 Dec 12, 2012 0:33
  • Deane Barker
    Member since: 2008
     

    Here's a clue:

    I looked through tblSystemBigTable.  There are a lot of rows in there for StoreName of "EPiServer.Editor.TinyMCE.ToolbarRow."

    Two things stick out --

    • None of these rows have any values.  All fields are NULL.

    • All of them are for EPiServer CMS v6:  "EPiServer.Editor.TinyMCE.ToolbarRow, EPiServer, Version=6.1.379.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7"
    #64170 Dec 12, 2012 0:50
  • Joshua Folkerts
    Member since: 2008
     

    try this

    protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e); 
    
            myEditor.InitOptions["browsers"] = "gecko"; 
            myEditor.InitOptions["convert_newlines_to_brs"] = 
                true;
        // Define the toolbar buttons as arrays of tool names.
        string[] row1 = new string[] { "bold", "italic", "underline" };
        string[] row2 = new string[] { "link", "unlink" }; 
                // Add the toolbars to the editor instance
        myEditor.ToolbarRows.Add(new ToolbarRow(row1));
        myEditor.ToolbarRows.Add(new ToolbarRow(row2));
                }

        

    #64171 Dec 12, 2012 6:34
  • Linus Ekström
    Member since: 2002
     

    Hi Deane!

    Are you getting this when editing in the editorial view or do you use the TinyMCE web control on your templates?

    #64173 Dec 12, 2012 7:53
  • Deane Barker
    Member since: 2008
     

    Both.

    In Admin Mode, if I view a Page Type then attempt to view any property which uses XhtmlString (anything that would require TinyMCE), it throws the exception.

    In my templates, it throws the exception on a page wihch embeds the Editor control.

    In the two situations, the exception gets thrown from different lines of code, but I've debugged both and in both cases, it happens when something tries to iterate TinyMCEPropertySettings.ToolbarRows.  In both cases, that collection has NULL objects in it.

    #64178 Dec 12, 2012 11:05
  • Linus Ekström
    Member since: 2002
     

    I have reported the following bug to investigate this:

    Bug #92736: Tiny MCE throws an exception when initializing after upgrading from CMS 6 R2
    #64182 Dec 12, 2012 11:41
  • Deane Barker
    Member since: 2008
     

    How does this play out, Linus?  When can I expect movement on it?  I'm a little hamstrung by this at the moment, with a half-upgraded install.  I might need to just export/import onto a new database, though I really, really want to avoid that.

    #64280 Dec 14, 2012 21:39
  • Linus Ekström
    Member since: 2002
     

    Hi Deane!

    Apparently we already had another bug report for this that has been fixed. Unfortunately it's not possible to just create an updated dll since the data got converted incorrectly in the upgrade. We have done an patch solution in the form of an aspx-file that fixes the data that can be applied to the site. I have informed the support team about this so I suggest that you get it from them. Hopefully we can release this fix/patch publicly when it has been tested some.

    Regards
    Linus Ekström

    #64294 Dec 17, 2012 12:53
  • alf.nilsson
    Member since: 2008
     

    Hi, I assume that the View VW_EPiServer.Editor.TinyMCE.ToolbarRow should be changed to SELECT ... FROM dbo.tblSystemBigTable instead of dbo.tblBigTable. Changing that works for me but might not be the correct solution.

    Your link leads to http://tfs01vm:8080/ which seems to be a server inside your local network.

    I cannot find any relevant bugs on http://world.episerver.com/bugs either.

    What is the status of this bug? If my solution is not the correct one, how can I find this patch-aspx?

    UPDATE

    Sorry, only changing the View works as long as I don't change any of my Settings or add any new ones.

    I've tried changing the reference to the tblSystemBigTable in tblBigTableStoreConfig but it still saves changes and new settings to tblBigTable.

    Also tried setting EPiServer version in the tables to 7.0.586.1 (original version on PropertyType in tblBigTableStoreInfo), 7.0.586.4 (my current EPiServer 7 version) and 6.0.530.0 (original version in basically any table and column untill I change or add anything through Admin mode).

    UPDATE AGAIN AFTER SOM SLEEP

    Noticed that the Stored Procedure that saves should be updated. Gonna compare some more with a brand new Alloy site as soon as I get the opportunity.

     

    SOME MORE UPDATES


    If you need to fix this manually, you can check out some instructions at http://talk.alfnilsson.se/2013/03/06/nullreferenceexception-from-tinymcesettings-inputtinyoptions-getactivetoolshtml-and-toolbarrow/

    #66505 Edited, Mar 03, 2013 19:11
  • Björn Ali Göransson
    Member since: 2007
     

    Sorry for reviving this, but as there was no update from EPiServer and neither has this (or a very similar) bug been solved, I'm posting some updates...

    Just experienced this in a CMS6R2->CMS9.7.2 upgrade. Thing is, even though the references' point to the right bigtable, the referenced type [EPiServer.Editor.HtmlEditorSettings] doesn't exist anymore. So the type is deemed invalid and you're trapped inside DDS... (as usual???)

    If all else fails, you could just try "nuking" property settings with this code:

    EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<EPiServer.Data.Dynamic.DynamicDataStoreFactory>().GetStore(typeof(EPiServer.Core.PropertySettings.PropertySettingsWrapper)).DeleteAll();

    Didn't Ben Morris call the DDS a weapon of mass destruction?

    #145892 Mar 14, 2016 22:16