This is a hair puller. When I try to create a template, I get the following error message:
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.] umbraco.cms.businesslogic.template.Template.get_MasterPageFile() +104 umbraco.cms.businesslogic.template.Template.getMasterPageContent() +14 umbraco.cms.businesslogic.template.Template.setupTemplate() +179 umbraco.cms.businesslogic.template.Template.GetAllAsList() +223 umbraco.cms.presentation.settings.editTemplate.Page_Load(Object sender, EventArgs e) +155 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 umbraco.BasePages.BasePage.OnLoad(EventArgs e) +15 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.4016; ASP.NET Version:2.0.50727.4016
By way of background, I'm trying to create a template in a site which >>used<< to have templates. However, either I accidentally deleted all of them, or something went wrong when my hosting company installed an SSL certificate for the site.
What's weird (to me, at least) is that I can look in the SqlServer table that holds the template definitions and see all of the original templates still present, as well as their definitions. And I can look in the masterpages folder and see all of the original templates still present there, too.
But so far as the backoffice is concerned, there are no templates. And I'm not allowed to create any new ones :).
Does anyone have any idea what happened and how to fix this? Can someone point me to documentation for the database tables? Maybe there's a relation linked to the template table that got munged.
If I have to I'll just blow away the site and restore it from my development server. But I'd really like to know what happened so I can avoid having it happen again. It's not good when content disappears and new content cannot be created!
this is the code line where it crashes and I can not see any reason why it should in a normal umb installation:
public string MasterPageFile { get { return GlobalSettings.FullpathToRoot + "masterpages" + System.IO.Path.DirectorySeparatorChar + Alias.Replace(" ", "") + ".master"; } }
FullpathToRoot and DirectorySeparatorChar strings come from .net system and Alias string is the Template name you just entered to create. I assume this Alias string is null which would produce your exception.
I guess there are some more files modified/removed for your umb installation, so I would recommend to restore all from your dev server.
If you really want to know whats wrong/missing you can download your current damaged installation and try it to set up on your local pc and use VS to debug ist. But I don't expect it is worth the effort.
Hi, i had this problem too, I accidently made 2 duplicate template
types, what i did was i manually deleted the duplicate entry in the
database table cmsDocumentType, but i failed to realize at first is that you have to remove it from umbracoNode aswell.
Can't Create Template
This is a hair puller. When I try to create a template, I get the following error message:
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:
Version Information: Microsoft .NET Framework Version:2.0.50727.4016; ASP.NET Version:2.0.50727.4016
By way of background, I'm trying to create a template in a site which >>used<< to have templates. However, either I accidentally deleted all of them, or something went wrong when my hosting company installed an SSL certificate for the site.
What's weird (to me, at least) is that I can look in the SqlServer table that holds the template definitions and see all of the original templates still present, as well as their definitions. And I can look in the masterpages folder and see all of the original templates still present there, too.
But so far as the backoffice is concerned, there are no templates. And I'm not allowed to create any new ones :).
Does anyone have any idea what happened and how to fix this? Can someone point me to documentation for the database tables? Maybe there's a relation linked to the template table that got munged.
If I have to I'll just blow away the site and restore it from my development server. But I'd really like to know what happened so I can avoid having it happen again. It's not good when content disappears and new content cannot be created!
- Mark
Hi Mark,
this is the code line where it crashes and I can not see any reason why it should in a normal umb installation:
FullpathToRoot and DirectorySeparatorChar strings come from .net system and Alias string is the Template name you just entered to create. I assume this Alias string is null which would produce your exception.
I guess there are some more files modified/removed for your umb installation, so I would recommend to restore all from your dev server.
If you really want to know whats wrong/missing you can download your current damaged installation and try it to set up on your local pc and use VS to debug ist. But I don't expect it is worth the effort.
Immo
Hi, i had this problem too, I accidently made 2 duplicate template types, what i did was i manually deleted the duplicate entry in the database table cmsDocumentType, but i failed to realize at first is that you have to remove it from umbracoNode aswell.
Hope this helps :)
is working on a reply...