If when you click on a node within your umbraco administration section and you receive the following:
[NullReferenceException: Object reference not set to an instance of an object.]
umbraco.controls.ContentControl.addControlNew(Property p, TabPage tp, String Caption) +106
umbraco.controls.ContentControl..ctor(Content c, publishModes CanPublish, String Id) +1057
umbraco.cms.presentation.editContent.OnInit(EventArgs e) +406
System.Web.UI.Control.InitRecursive(Control namingContainer) +142
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1476
I can tell you that you have added either a custom control, or a control of a certain type does not exist within your bin directory. I kept receiving this when I created a new umbraco instance – I think I must have a mismatch of umbraco versions causing my DB to contain a type which does not exist within my assemblies. Here’s what I did to debug this issue:
1. Downloaded the umbraco source code from codeplex
2. Changed it to ‘Debug’ config, rebuilt everything, copied the cms.dll and cms.pdb from the output directory into my umbraco bin folder
3. Typed ctrl+alt+e in visual studio and made sure that the checkbox next to ‘thrown’ for common language runtime exceptions was selected.
3. Attached the visual studio instance that currently has the umbraco source code loaded, to w3wp.exe (the one running my umbraco website).
4. Clicked into the admin section, and caused the error by clicking on one of the nodes that has the problem.
5. Visual studio brakes into mscorelib inside an indexer, I used my call stack window to jump up a few frames, which brought me eventually into DataType.cs
6. Line 79 in my version of the code shows:
interfaces.IDataType dt = f.DataType(_controlId);
Essentially what this is doing, is loading an IDataType from the given control ID. If you hover over the ‘Id’ property, this will be your key in determining which control is currently wrong. Save the contents of both the ‘Id’ property and ‘_controlId’ into notepad.
7. I jumped into my umbraco database, and select * from cmsDataType
You’ll notice the control ID in there, you’ll also notice the controlID you saved is within this table, as is the ID – this means that you’ve basically told umbraco that there is a control of that type available somewhere within your *.dll’s within your bin directory in umbraco (If you look inside the f.DataType() call, youll notice that it does a type resolution by searching for all types of IDataType within the *.dll wildcard search within the umbraco bin folder).
The problem is that it can’t find that control type within the bin folder. I haven’t looked into what exactly that means, but I can only assume you can create custom controls in umbraco by marking them with an attribute guid that matches that control ID, then it will dynamically load that control and use it for that particular data type. In my case, I have no idea what data type is failing, (and you probably wont either).
To fix the problem temporarily, what I did was simply copy another ControlId Guid from within cmsDataType table (any should do for now, preferably a plain text control ID or something, if you can work out which one that is… I guessed…), and update the rows which match ’select * from cmsDataType where ControlId = ‘TheControlIdYouSaved’ to be the new guid you just copied from the table.
So you’re essentially just using a different control ID now instead of the one that isnt working…. perform an IISReset, and you should notice your nodes are now clickable…. click through the tabs and work out which one was causing the issue, and you might be able to figure out what control was missing (if you’re lucky) and either a) install it into your bin directory or b) update your umbraco version so that the control that was missing is available…
Cheers guys,
Matt