Tuesday 20 December 2011

Lost templates and document types in Umbraco Settings tree

Today we came across an issue where the Umbraco Templates tree in Settings was not being populated and when we tried to edit a Document Type we got the following error:

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:


Line 49:         public string MasterPageFile
Line 50:         {
Line 51:             get { return IOHelper.MapPath( SystemDirectories.Masterpages  
+ "/" + Alias.Replace(" ", "") + ".master") ; }
Line 52:         }
Line 53: 

Source File: C:\Projects\288Group\WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs    Line: 51

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   umbraco.cms.businesslogic.template.Template.get_MasterPageFile() in C:\Projects
\288Group\WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs:51
   umbraco.cms.businesslogic.template.Template.getMasterPageContent() in C:\Projects\
288Group\WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs:153
   umbraco.cms.businesslogic.template.Template.setupNode() in C:\Projects\288Group\
WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs:141
   umbraco.cms.businesslogic.CMSNode..ctor(Guid uniqueID) in C:\Projects\288Group\
WestminsterCollection\Shared\Umbraco\cms\businesslogic\CMSNode.cs:341
   umbraco.cms.businesslogic.template.Template..ctor(Guid id) in C:\Projects\288Group
\WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs:63
   umbraco.cms.businesslogic.template.Template.GetAllAsList() in C:\Projects\288Group
\WestminsterCollection\Shared\Umbraco\cms\businesslogic\template\Template.cs:365
   umbraco.settings.EditContentTypeNew.bindTemplates() in C:\Projects\288Group\
WestminsterCollection\Shared\Umbraco\presentation\umbraco\settings\
EditNodeTypeNew.aspx.cs:56
   umbraco.settings.EditContentTypeNew.Page_Load(Object sender, EventArgs e) 
in C:\Projects\288Group\WestminsterCollection\Shared\Umbraco\presentation\umbraco
\settings\EditNodeTypeNew.aspx.cs:35
   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) in C:\Projects\288Group
\WestminsterCollection\Shared\Umbraco\businesslogic\BasePages\BasePage.cs:325
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint
, Boolean includeStagesAfterAsyncPoint) +627


After doing some digging around we found the answer was that one of the cmsTemplate records was missing from the database.

select * 
from UmbracoNode n 
left join cmsTemplate t on t.nodeid = n.id
where n.nodeObjectType = '6FBDE604-4178-42CE-A10B-8A2600A2F07D'

The fix is to either create a new record for this (we were able to do this because the error was on our development site and we copied the live record back) or to remove the umbracoNode record. Either wat you then fix this broken relationship and fixes the problem.

As usual the Umbraco site is invaluable!

http://forum.umbraco.org/yaf_postst8368_Losing-templates-from-tree.aspx

I have no idea how this record was removed but it is possible that it happened during our weekly live to dev copy of the database or something crashed during a delete of that template.

Thursday 15 December 2011

Umbraco "Object moved to here"

The mains thread for this can be found at:

http://our.umbraco.org/forum/ourumb-dev-forum/bugs/8107-Object-moved-to-here-error-on-sign-in-or-out-using-membership-package

Basically an issue with the homepage in an Umbraco website, when logged in you get a "Object moved to here" header with a link to self. One answer is to check your hostnames in the content section, one of mine had a trailing forward slash (/). Once I removed  that it worked again.

Strange one...

Tuesday 13 December 2011

UPDATE OPENQUERY

We run lots of integration stuff between COBOL and SQLServer and we are starting to update records in COBOL which means we need a speedy way to do update statements using either OPENQUERY or the four part path to the linked server.

So, I can update a record using the four part path no problem but it's not the quickest...

UPDATE SITWEBDEV.SITWEBDEV..T_Changes_Webout
SET field = value
where etc.

Then I tried it with OPENQUERY...


UPDATE OPENQUERY([SITWEBDEV] , '
select Process
from T_Changes_Webout
where Id < 14
') 
SET Process = 0

... and I got the following error:


OLE DB provider "MSDASQL" for linked server "SITWEBDEV" returned message "Key column information is insufficient or incorrect. Too many rows were affected by update.".
Msg 7343, Level 16, State 4, Line 1
The OLE DB provider "MSDASQL" for linked server "SITWEBDEV" could not UPDATE table "[MSDASQL]". 


The solutions was that the main key of the table was not included in the inner select statement. Once I added this it ran and was much quicker too.



update OPENQUERY([SITWEBDEV] , '
select Id, Process
from T_Changes_Webout
where Id < 14
') 
set Process = 0

Hat tip for the solution to:

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_25603503.html

Access denied on commit in TortoiseSVN

Ok, issue one!

We recently had one of the developers leave and I have been trying to get all his projects submitted to source control by logging in to his old machine using his username and password. We're using TortoiseSVN and the error I was getting was:

'\\ServerName\Repositories\FolderName\db\transactions\2670-1.txn': Access is Denied

I found various things about turning off antivirus software or stopping it from scanning that folder but in this case it turned out that the guy who runs the Exchange server had removed the developer from an exchange group which had access to the repositories share. I gave the user permissions to the share and voila!

Easy one to start with!

Intro

With thirteen years in IT and the internet/web so far I have often thought of the huge resource I would have created by now if I had blogged every single issue I had faced over the years. From tiny syntax lookups and javascript mashups back in the day when I was coding static web pages to SQL integrations with COBOL; they would all be there when I or anyone else needed them!

Pity!

Oh well, better late than never, here it is! Starting now I will try to document as many of these  issues, solutions and other interesting (to some) little tit bits!