Page Templates - "Object Reference Not set to and instance of an object"
I created a new site with SF 4.1. I have been using the same two templates for a few days now and everything has been fine. Today I created a new template based off another template and now I am unable to access page templates entirely. I just get spammed with alerts for "object reference not set to an instance of an object". Trying to use firebug is near impossible due to the error continually spamming, but I did manage to see it is throwing a 500 server error.
Hi Stacey,
Please enable the service tracer
msdn.microsoft.com/.../ms732023.aspx
and send the file to us. It will provide some more details about the actual error and what is the reason for it.
Please check the the template you have created is not based on itself. We have this bug in the previous release SP1.
Greetings,
Ivan Dimitrov
the Telerik team
The new template I made prior to this is not based on itself. I looked
at the page templates table and it is inheriting from the masterpage
template that I uploaded a few days ago.
I have a base template which is the master page. Nothing unusual with
it. Just using content placeholders and normal html markup. The other
templates are based off this template.
Edit:
I have submitted the trace file through your ticketing system and referenced this post in the ticket.
Here is something I found when looking through the trace.
Telerik.Sitefinity.Modules.Pages.Web.Services.Model.PageTemplateViewModel.<
GetNodesNewerThanPublishedWithSameTemplate
>b__18(PageNode p)
System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
Telerik.Sitefinity.Modules.Pages.Web.Services.Model.PageTemplateViewModel.GetNodesNewerThanPublishedWithSameTemplate(IList`1 draftNodes)
Telerik.Sitefinity.Modules.Pages.Web.Services.Model.PageTemplateViewModel.GetPagesBasedOnTempalate(PageTemplate template)
Telerik.Sitefinity.Modules.Pages.Web.Services.Model.PageTemplateViewModel..ctor(PageTemplate pageTemplate)
Telerik.Sitefinity.Modules.Pages.Web.Services.PageTemplatesService.<>c__DisplayClass2.<
GetPageTemplatesInternal
>b__1(PageTemplate t)
System.Collections.Generic.List`1.ForEach(Action`1 action)
Telerik.Sitefinity.Modules.Pages.Web.Services.PageTemplatesService.GetPageTemplatesInternal(String root)
SyncInvokeGetPageTemlates(Object , Object[] , Object[] )
System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
I still have not resolved this, but want to keep posting what I am finding. There is not much else I can do at this point, but keep trying to dig.
All my pages are still working and they are still displaying according to the templates they are assigned to. I started looking more into the tables to see what I can find.
I did a query on the sf_draft_pages table by the template_id of the new template that all this mess seem to be stemming from. Now from what I can tell, I do not have a page that is still a draft when I look via the interface, but I do get 1 result back on the query.
I then took the page_id from this and checked against the sf_page_node table. I do not get any results back on this. Am I looking at this the right way and if so should I try to remove the record in the sf_draft_pages table? I have a backup of the db.
Hi Stacey,
Did you find any solution for this issue?
I'm getting the same js alert indicating "object reference not set to an instance of an object" in my Page Templates section, and doesn't show my templates.
In my test, this seems to be an DB issue, because when I access to my Page Templates Service (mydomain.com/.../) it shows "Detail":"Object reference not set to an instance of an object."
Any help will be really appreciated.
Thanks,
Juan
Juan,
I am still trying to get this one taken care of. I received a reply from Sonya via the support ticket system with a script to run, but it had no effect on my problem. I am waiting for another response on this and hope to hear something very soon. I need to launch my site by the end of this week and not being able to access my design templates is a huge time sink.
Let me know if you come up with something and I will do the same here.
Stacey,
Thanks for you replay. Could I check the script sent to you via the support ticket?
I only found
DELETE FROM [dbo].[sf_draft_pages] where page_id IS NULL
I actually had found the same post you are referring to and I too did not have any records in sf_page_drafts that had a null page_id.
Here is what was sent to me based on the support ticket I sent with the svc trace. My installation for this site was brand new as 4.1 and not an upgrade. My masterpage file has content placeholders and nothing else in it. I registered this template and used it without issues for 3 days. I had a second template that used the master as a base. Both these templates worked fine. Then I created a third template and again used the master as the base. I then created a new page and based it of the third template. At this point I could no longer get into page templates without the error message.
"There is an issue with upgrade of content blocks in Page Templates. Do you have content blocks in your master template?
UPDATE
[sf_object_data]
SET
[sf_object_data].object_type =
'Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlockBase'
FROM
[sf_object_data]
INNER
JOIN
[sf_page_templates]
ON
[sf_object_data].page_id = [sf_page_templates].id
WHERE
object_type =
'Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlock'
GO
UPDATE
[sf_object_data]
SET
[sf_object_data].object_type =
'Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlockBase'
WHERE
original_control_id
in
(
SELECT
[sf_object_data].id
FROM
[sf_object_data]
INNER
JOIN
[sf_page_templates]
ON
[sf_object_data].page_id = [sf_page_templates].id
WHERE
object_type =
'Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlockBase'
)
AND
object_type =
'Telerik.Sitefinity.Modules.GenericContent.Web.UI.ContentBlock'
GO
Hi Stacey,
I finally could fix this error. I found the solution in this post: www.sitefinity.com/.../object-reference-not-set-to-an-instance-of-an-object-in-design-template.aspx
Hope this help you!
- Juan
Thanks for directing me to that post. I too, was able to fix my issue by following that post. I also found the cause, for me at least, was that going from a normal page with content to a group page will cause this error.