Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • webmonger 130 posts 285 karma points
    Feb 04, 2014 @ 14:15
    webmonger
    0

    Upgrade from 4.5 to 6.1.6 Problem with users section

    I have sucesfully upgraded a site from 4.5 to 6.1.6 following the standard steps.

    I have updated the trees.config and applications.config to add the custom sections I have installed.

    There is one final issue that i have no idea where the problem is.

    When you click on a user name in the users section I get a YSOD:

    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.Core.Persistence.Repositories.TemplateRepository.PerformGet(Int32 id) in d:\temp\UmbracoV7Branch\src\Umbraco.Core\Persistence\Repositories\TemplateRepository.cs:74
       Umbraco.Core.Persistence.Repositories.RepositoryBase`2.Get(TId id) in d:\temp\UmbracoV7Branch\src\Umbraco.Core\Persistence\Repositories\RepositoryBase.cs:94
       Umbraco.Core.Persistence.Repositories.ContentTypeRepository.<PerformGet>b__0(DocumentTypeDto template) in d:\temp\UmbracoV7Branch\src\Umbraco.Core\Persistence\Repositories\ContentTypeRepository.cs:60
       System.Linq.WhereSelectListIterator`2.MoveNext() +243
       System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +535
       System.Linq.Enumerable.ToList(IEnumerable`1 source) +79
       Umbraco.Core.Persistence.Repositories.ContentTypeRepository.PerformGet(Int32 id) in d:\temp\UmbracoV7Branch\src\Umbraco.Core\Persistence\Repositories\ContentTypeRepository.cs:60
       Umbraco.Core.Persistence.Repositories.RepositoryBase`2.Get(TId id) in d:\temp\UmbracoV7Branch\src\Umbraco.Core\Persistence\Repositories\RepositoryBase.cs:94
       Umbraco.Core.Persistence.Repositories.<PerformGetAll>d__2.MoveNext() in d:\temp\UmbracoV7Branch\src\Umbraco.Core\Persistence\Repositories\ContentTypeRepository.cs:90
       Umbraco.Core.Persistence.Repositories.RepositoryBase`2.GetAll(TId[] ids) in d:\temp\UmbracoV7Branch\src\Umbraco.Core\Persistence\Repositories\RepositoryBase.cs:156
       Umbraco.Core.Services.ContentTypeService.GetAllContentTypes(Int32[] ids) in d:\temp\UmbracoV7Branch\src\Umbraco.Core\Services\ContentTypeService.cs:88
       umbraco.cms.businesslogic.web.DocumentType.GetAllAsList() +78
       umbraco.cms.presentation.user.EditUser.setupChannel() +124
       umbraco.cms.presentation.user.EditUser.Page_Load(Object sender, EventArgs e) +3190
       umbraco.BasePages.BasePage.OnLoad(EventArgs e) +18
       System.Web.UI.Control.LoadRecursive() +70
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3177
    

    Does anyone have any ideas why the Users section would be broken? As far as i know the database upgrade went as expected on each upgrade 4.5.1 - 4.8.1 - 4.9.1 - 6.1.6

    Thanks

    Jon

     

  • Comment author was deleted

    Feb 04, 2014 @ 14:18

    Look like it has something todo with the content channels, do you have these setup for users? Maybe it was setup and the doctype it was using has been removed...

  • webmonger 130 posts 285 karma points
    Feb 05, 2014 @ 10:49
    webmonger
    0

    Thanks Tim

    I'm not sure what content channels are, could you elaborate a little?

    Is there a sql statement i can run on the DB to check for these links so i can manually remove them if they are causing the problem?

    Cheers

    Jon

  • Comment author was deleted

    Feb 05, 2014 @ 10:54

    Content channels allow users to post content from word/livewriter/... yeah you can probably do that but don't know where it's stored, so have a quick look in the sourcecode 

  • webmonger 130 posts 285 karma points
    Feb 05, 2014 @ 12:47
    webmonger
    0

    Hey Tim

    So I downloaded the source and compiled it and there seems to be an issue in the TemplateRepository.cs file in PerformGet. I'm not 100% sure what the whole file does but the error occurs in here.

    Basically when this query is run it does:

    var sql = GetBaseQuery(false);
    sql.Where(GetBaseWhereClause(), new { Id = id });
    var dto = Database.Fetch<TemplateDto, NodeDto>(sql).FirstOrDefault();

    Which looks like it returns a TemplateDto which is populated as i would expect but in this case the Master value is 0

    When it gets to line 71:

    if (dto.Master.HasValue)

    This works fine because the value is == 0 not == null

    directly following this the following code executes:

    var masterTemplate = Get(dto.Master.Value);
    template.MasterTemplateAlias = masterTemplate.Alias;
    template.MasterTemplateId = new Lazy<int>(() => dto.Master.Value);

    This obviously tries to get a template with an id of 0 which returns a null value so when:

    masterTemplate.Alias;

    is called it causes a Null Ref exception.

    I now know this is caused because my cmsTemplate contains a record where the master is == 0  what i dont know is what this value should be. In that table i seem to have a bunch that are 0 some that are NULL and 2 that actually have a value.

    So i guess the question is Bug or not? I'm not sure what the process of upgrading has done in the database through the process outlined above so i cant really call if this would happen again to someone else or if this is a one off.

    I guess the question is, do i patch the code so it takes in to account 0 being in the master field or do i change all the values in my DB to NULL?

    Cheers

    Jon

     

  • Niels Lynggaard 192 posts 550 karma points
    Jul 18, 2014 @ 13:43
    Niels Lynggaard
    0

    I'm experiencing the same thing here..

    Did you ever resolve this?

  • webmonger 130 posts 285 karma points
    Jul 18, 2014 @ 21:08
    webmonger
    2

    Hi Niels

    I think i ended up changing the 0 value to NULL.

    Once I'd done that the error did not come back.

    Hope that helps :)

    Jon

  • Niels Lynggaard 192 posts 550 karma points
    Jul 20, 2014 @ 00:46
    Niels Lynggaard
    0

    Cool, I'll see if that can fix things.

  • Niels Lynggaard 192 posts 550 karma points
    Jul 20, 2014 @ 01:06
    Niels Lynggaard
    0

    YES! It worked.

    I first noticed the problem under the Document Types node under Settings. It just didn't expand and my nodes in the contenttree would fail (The ones with master=0 instead of master=NULL)..

    Updating the cmsTemplate table fixed this!

    Thanx, Jon!

Please Sign in or register to post replies

Write your reply to:

Draft