Object reference not set to an instance of an object-error Saving PropertySettings

Vote:
 

The propertysettings DDS has crashed somehow and I'm now always getting this error when saving global property settings. What can be done to solve the problem?

Server Error in '/' Application.


Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

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.]
System.Object.GetType() +0
EPiServer.Data.Serialization.DeReferencedPropertyBag.DeReferenceCollection(String elementName, Object elementValue, IDictionary`2 loadedObjectsInContext) +739
EPiServer.Data.Serialization.DeReferencedPropertyBag.DeReferenceObject(IDictionary`2 loadedObjectsInContext) +490
EPiServer.Data.Cache.<>c__DisplayClass4.<Add>b__3() +124
EPiServer.Data.Cache.CacheProvider.Add(String key, Func`1 action, String[] dependencyKeys) +72
EPiServer.Data.Dynamic.Providers.DbDataStoreProvider.LoadObject(ProviderCallContext context) +350
EPiServer.Data.Dynamic.Providers.<>c__DisplayClass1`1.<Execute>b__0() +183
EPiServer.Data.Dynamic.Providers.DbDataStoreProvider.InternalExecute(Func`1 method) +59
EPiServer.Data.Dynamic.Providers.DbDataStoreProvider.Execute(Func`1 action) +272
EPiServer.Data.Dynamic.DynamicDataStore.InternalLoad(Identity id, Type type, LoadAsObjectType loadAs, ProviderCallContext parentContext) +770
EPiServer.Data.Dynamic.EPiServerDynamicDataStore.Load(Identity id) +66
EPiServer.Data.Dynamic.DynamicDataCollectionEnumerator.get_Current() +362
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +342
EPiServer.Core.PropertySettings.PropertySettingsRepository.get_GlobalsHolder() +88
EPiServer.Core.PropertySettings.PropertySettingsRepository.SaveGlobal(PropertySettingsWrapper global) +67
EPiServer.UI.Admin.EditPageTypeGlobalSettings.Save() +178
EPiServer.UI.WebControls.ToolButton.OnClick(EventArgs e) +90
EPiServer.UI.WebControls.ToolButton.RaisePostBackEvent(String eventArgument) +170
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981



Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

#39719
May 30, 2010 17:16
Vote:
 

Hi Johan!

Can you reproduce this on other cms 6 sites? Could you post a repro for this?

Regards
Linus Ekström
EPiServer Development Team

#39730
May 31, 2010 7:12
Vote:
 

This is a shot in the dark, but has the PropertySettings class or the class of any property in the PropertySettings class had their names/namespaces changed? I think I saw errors like this once when I was working with DDS (not PropertySettings specifically though) and was playing around with renaming classes, deleting properties, remapping etc.

#39732
May 31, 2010 9:58
Vote:
 

Off the top of my head this is what we did:

  1. Added a custom checkboxlist property with a PropertySettings class with a int property
  2. Removed the int prop and added a string prop
  3. Big error then so we deleted the entire plugin and added a new one with another name and a string property from the start

Now the status is that saving local property settings inside a page type works as expected. Loading the global settings ui for the property also works great. But when saving the error above occurs.

#39734
May 31, 2010 10:27
Vote:
 

In another EPiServer 6 site (also upgraded from 5) we get the same error when trying "Save as copy" for TinyMCE editor settings. Creating new global settings works there though.

#39737
May 31, 2010 14:21
Vote:
 

Hi,

I assume you changed properties on a class that implements IPropertySettings. When you do this (also for any class whose instances are stored in the DDS) you need to re-map the type in the DDS.

To make life easier when trying stuff out you can add an initialization module to you project and then check if you type's schema matches that in the DDS. If it doesn't then you can re-map it. I would recommend that you remove this before the code goes live as you probably want to have better control over when types are re-mapped as this can be an expensive operation if there is alot of data in the DDS for you type.  See below for an example:

 

using EPiServer.Framework;

using EPiServer.Data.Dynamic;

using EPiServer.Data;

 

[InitializableModule]
    [ModuleDependency(typeof(DataInitialization))]
    public class InitializationModule : IInitializableModule
    {
        #region IInitializableModule Members
        public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context)
        {
            StoreDefinition existingDef = StoreDefinition.Get(typeof(MyPropertySettings).FullName);
            if (existingDef != null)
            {
                if (!existingDef.ValidateAgainstMappings(typeof(MyPropertySettings), false))
                {
                    existingDef.Remap(typeof(MyPropertySettings));
                    existingDef.CommitChanges();
                }
            }
        }
        public void Preload(string[] parameters)
        {
            throw new NotImplementedException();
        }
        public void Uninitialize(EPiServer.Framework.Initialization.InitializationEngine context)
        {
        }
        #endregion
    }

 

[InitializableModule]

[ModuleDependency(typeof(DataInitialization))]

public class InitializationModule : IInitializableModule

{

#region IInitializableModule Members

 

public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context)

{

StoreDefinition existingDef = StoreDefinition.Get(typeof(MyPropertySettings).FullName);

 

if (existingDef != null)

{

if (!existingDef.ValidateAgainstMappings(typeof(MyPropertySettings), false))

{

existingDef.Remap(typeof(MyPropertySettings));

existingDef.CommitChanges();

}

}

}

 

public void Preload(string[] parameters)

{

throw new NotImplementedException();

}

 

public void Uninitialize(EPiServer.Framework.Initialization.InitializationEngine context)

{

}

 

#endregion

}

 

In terms of sorting out your existing problem then the easiest would be to start with a clean database. If this is not practical then you will need to manually remove the offending data from the DDS tables. Send me an email to paul [dot] smith [at] episerver.com if you need this and I will try and help you.

 

Paul Smith

Developer Evangelist.

#39749
Jun 01, 2010 9:44
Vote:
 

Thanks Paul for this and the e-mail on the side.

For others interest I backed up my DB and ran these SQL-commands:

Exec BigTableDeleteAll @ViewName = '[VW_EPiServer.Core.PropertySettings.PropertySettingsGlobals]'
Exec BigTableDeleteAll @ViewName = '[VW_EPiServer.Core.PropertySettings.PropertySettingsWrapper]'

-- xxx is the fully qualified namespace and class for your IPropertySettings implementation
Exec BigTableDeleteAll @ViewName = '[xxx]'

-- xxx is the fully qualified namespace and class for your IPropertySettings implementation
Delete from tblBigTableStoreInfo where StoreName = 'xxx'
I also added the initmodule above. Now I'm back to normal when saving property settings.
#39780
Jun 01, 2010 15:56
Vote:
 

Hey Guys, I have the same issue. But the"existingDef" is null. 

StoreDefinition existingDef = StoreDefinition.Get(typeof(ProductPickerProperty).FullName);

What should i do? I don't get what typeof i should put?

What i have done is to add a new EPiServer.Business.Commerce.Plugins.ProductPicker.SpecializedProperties.ProductPickerProperty, and i want to put a default template (ascx) to the property.

the url to Add Settings is (/CMS/Admin/EditPageTypeGlobalSettings.aspx?value=EPiServer.Business.Commerce.Plugins.ProductPicker.SpecializedProperties.ProductPickerPropertyControl,%20XXX.Externweb.Web,%20Version=0.6.0.0,%20Culture=neutral,%20PublicKeyToken=null)

I also have the same save problem in Edit global settings for TinyMCE (EPiServer.SpecializedProperties.PropertyXhtmlString), Should i use EPiServer.Editor.TinyMCE.ToolbarRow? or EPiServer.Editor.TinyMCE.TinyMCESettings? Please explaine better? if a do so, none is passing throu to "if (!existingDef.ValidateAgainstMappings(...."

And why should i do the things Johan Kronberg maid, what does it do?

 

#56926
Edited, Feb 16, 2012 11:39
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.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.