Error occurred when editing the content which has type of XHTML string (>255)

Vote:
 

Hi,

I'm experiencing an NullReferenceException when I'm trying to edit a page which contains a field with "XHTML String (>255)".

Below is the complete stack trace:

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Editor.TinyMCE.InputTinyOptions.GetActiveToolsHTML() +183
   EPiServer.Editor.TinyMCE.InputTinyOptions.AddTinyButtonsControl() +103
   EPiServer.Editor.TinyMCE.InputTinyOptions.OnPreRender(EventArgs e) +22
   System.Web.UI.Control.PreRenderRecursiveInternal() +103
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

Anybody encountered this problem?

#64423
Dec 20, 2012 12:21
Vote:
 

I have the same problem, did you find a solution for this?

#64704
Jan 07, 2013 15:28
Vote:
 

In your model class, or pagetype, what is the return type of the property.  It should look something like this
public virtual XhtmlString MainBody{get;set;}  Is that what you have for your property

#64716
Jan 08, 2013 4:37
Vote:
 

Hi Eduardo!

Is this a new installation or an upgraded site?

#64717
Jan 08, 2013 8:14
Vote:
 

For me this is a upgrade site

[Display(Name = "Main Body", GroupName = SystemTabNames.Content, Order = 3)]
public virtual XhtmlString MainBody{get;set;}

This is how I define a mainbody with xhtmlstring, the same as you Joshua.

#64718
Jan 08, 2013 8:16
Vote:
 

These in an issue with a custom table in the DDS that holds the information about the settings for the Tiny MCE editor that may happen when upgrading to EPiServer CMS 7. The support team has a fix for this so please open a support case to get hold of this.

#64729
Jan 08, 2013 11:56
Vote:
 

adding the bug number for references:

Bug #91274: [Upgrade] Can't open edit mode of Home page ( OPE and Form Editing)

#64731
Jan 08, 2013 13:04
Vote:
 

Linus: Why can't you just post the fix here? I'm guessing it's just some SQL script that corrects the problem?

#65485
Jan 30, 2013 16:30
Vote:
 

<%@ Page Language="C#" AutoEventWireup="False" Inherits="System.Web.UI.Page" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="EPiServer.Data.Dynamic" %>
<%@ Import Namespace="System.Reflection" %>

<!DOCTYPE html>
<script runat="server">
class StoreInfo
{
public string TableName;
public Type Type;
}

public void UpgradeFix(object sender, EventArgs e)
{
// A dictionary of DDS store name to Type/TableName
var remappings = new Dictionary<string, StoreInfo>();

// Get all types from the app domain that has a specific DDS table configured.
foreach(Type t in AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(a => a.GetTypes())
.Where(a => Attribute.IsDefined(a, typeof(EPiServerDataTableAttribute))))
{
var tableAttributes = (EPiServerDataTableAttribute[])t.GetCustomAttributes(typeof(EPiServerDataTableAttribute), false);
var storeAttributes = (EPiServerDataStoreAttribute[])t.GetCustomAttributes(typeof(EPiServerDataStoreAttribute), false);
foreach(var attrib in tableAttributes)
{
// Any configured store name or the type name
string storeName = (storeAttributes.FirstOrDefault() != null ? storeAttributes.FirstOrDefault().StoreName : null) ?? t.FullName;
remappings.Add(storeName, new StoreInfo
{
TableName = attrib.TableName,
Type = t
});
}
}

var instance = EPiServer.Data.Dynamic.Providers.DataStoreProvider.CreateInstance();
foreach (var definition in StoreDefinition.GetAll())
{
StoreInfo mapping;
if (remappings.TryGetValue(definition.StoreName, out mapping))
{
Response.Write("Remapping: " + definition.StoreName + "<br/>");

// Save each definition type that has a specific table definition and explicitly set the tableName,
// since this fails for types without primitive properties
definition.GetType().GetProperty("TableName").SetValue(definition, mapping.TableName, null);
instance.SaveStoreDefinition(definition);
}
}
}

//public void UpgradeRemap(object sender, EventArgs e)
//{
// // What the Upgrade script does
// var instance = EPiServer.Data.Dynamic.Providers.DataStoreProvider.CreateInstance();
// foreach (var definition in EPiServer.Data.Dynamic.StoreDefinition.GetAll())
// {
// instance.SaveStoreDefinition(definition);
// }
//}

</script>
<html>
<body>
<form runat="server">
<p>Remember to back up your database before running this patch</p>
<asp:Button runat="server" Text="Upgrade Fix" OnClick="UpgradeFix" />
</form>
</body>
</html>

#65496
Jan 30, 2013 19:34
Vote:
 

Thanks! Tried it and got this result:

Remapping: BackgroundJobStore
Remapping: DashboardContainerStore
Remapping: DashboardLayoutPartStore
Remapping: DashboardStore
Remapping: DashboardTabLayoutStore
Remapping: DashboardTabStore
Remapping: EPiServer.ApplicationModules.Security.SiteSecret
Remapping: EPiServer.Core.PropertySettings.PropertySettingsContainer
Remapping: EPiServer.Core.PropertySettings.PropertySettingsGlobals
Remapping: EPiServer.Core.PropertySettings.PropertySettingsWrapper
Remapping: EPiServer.Editor.TinyMCE.TinyMCESettings
Remapping: EPiServer.Editor.TinyMCE.ToolbarRow
Remapping: EPiServer.MirroringService.MirroringData
Remapping: EPiServer.Packaging.Storage.ApiKeyEntity
Remapping: EPiServer.Packaging.Storage.PackageEntity
Remapping: EPiServer.Packaging.Storage.StorageUpdateEntity
Remapping: EPiServer.Shell.Profile.ProfileData
Remapping: EPiServer.Shell.Storage.PersonalizedViewSettingsStorage
Remapping: GadgetStore
Remapping: VisitorGroup
Remapping: VisitorGroupsStatisticsSettingsStore
Remapping: XFormFolders
Remapping: XFormsViewerSettingsStore

But trying to open one of the settings (ui/cms/Admin/EditPageTypeGlobalSettings.aspx?value=ec8d4e3f-7f43-4831-af04-b85810552a4d) still gives me the error below. I'm running Patch 1, maybe that's part of the problem?

[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Editor.TinyMCE.InputTinyOptions.GetActiveToolsHTML() +168
   EPiServer.Editor.TinyMCE.InputTinyOptions.AddTinyButtonsControl() +92
   EPiServer.Editor.TinyMCE.InputTinyOptions.OnPreRender(EventArgs e) +22
   System.Web.UI.Control.PreRenderRecursiveInternal() +83


#65508
Jan 31, 2013 9:37
Vote:
 

Is this still a problem?

The script Linus supplied should've fixed this issue. At least judging from your call stack and the information at hand.

#66402
Feb 28, 2013 10:03
Vote:
 

The script made it worse. All settings then caused the crash. I had to create new global settings and went with them.

#66404
Feb 28, 2013 10:09
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.