Copied to clipboard

Flag this post as spam?

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


  • Don Nehc 69 posts 222 karma points
    Oct 29, 2016 @ 04:08
    Don Nehc
    0

    Runtime Cache Provider Error

    Hello,

    I got this error from GetCacheItem internal method.

    {"Object reference not set to an instance of an object."}

    This is generic, not sure exactly what is causing this. I did add a new cache key, and a new node. The node can open create dialog box, but after I enter an alias, and press create, that is when I received this error. I appreciate any pointers you can provide.

    Best, -Don

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Oct 30, 2016 @ 09:32
    Dave Woestenborghs
    0

    Hi Don,

    When does this error occur ? Do you have a code example ?

    Dave

  • Don Nehc 69 posts 222 karma points
    Oct 30, 2016 @ 17:01
    Don Nehc
    0

    Hello Dave,

    The error came from inside the "simple.ascx.cs" sbmt_click event. The error message came from catch:

               try
                {
    
                    var returnUrl = LegacyDialogHandler.Create(
                        new HttpContextWrapper(Context),
                        new User(Security.CurrentUser),
                        Request.GetItemAsString("nodeType"),
                            nodeId,
                            rename.Text.Trim(),
                            Request.QueryString.AsEnumerable().ToDictionary(x => x.Key, x => (object)x.Value));
    
                    BasePage.Current.ClientTools
                    .ChangeContentFrameUrl(returnUrl)
                    .ReloadActionNode(false, true)
                    .CloseModalWindow();
                }
                catch (Exception ex)
                {
                    CustomValidation.ErrorMessage = "* " + ex.Message;
                    CustomValidation.IsValid = false;
                }
            }
    

    because I have a new task defined "SchoolProgramTasks.cs":

      public override bool PerformSave()
        {
    
            var checkingSchoolProgram = cms.businesslogic.schoolprogram.SchoolProgram.GetByAlias(Alias);
        }
    

    And my businesslogic "SchoolProgram.cs":

      public static SchoolProgram GetByAlias(string alias)
            {
                return ApplicationContext.Current.ApplicationCache.RuntimeCache.GetCacheItem<SchoolProgram>(
                    GetCacheKey(alias),
                    timeout: TimeSpan.FromMinutes(30),
                    getCacheItem: () =>
                    {
                        var schoolprogram = ApplicationContext.Current.Services.SchoolProgramService.GetByAlias(alias);
                        if (schoolprogram == null) return null;
                        return new SchoolProgram(schoolprogram);
                    });
            }
    

    I traced the error to inside "DeepCloneRuntimeCacheProvider.cs" and the "GetCacheItem" call. There, I got object reference error.

    I wonder if that is because of permission issues. The school program is a node under a new application I created. I have another node under "settings" application and that seems to work.

    Thank you for your help, -Don

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Oct 31, 2016 @ 07:19
    Dave Woestenborghs
    0

    Hi Don,

    A couple of more questions :

    • What version of Umbraco are you using ?
    • Where are you using this simple.ascx
    • What is ApplicationContext.Current.Services.SchoolProgramService ?

    In general I would like to to know what your goal is.

    Dave

  • Don Nehc 69 posts 222 karma points
    Oct 31, 2016 @ 15:40
    Don Nehc
    0

    Hello Dave,

    I have added a new application "School", and in the application, I want users to create new programs. I have a similar feature working under "Settings". I think the difference is that "Settings" is an out of box features, and my school application application is customization.

    enter image description here

    To answer your question:

    1) I run version 7.4.1 2) I defined a new task SchoolProgramTasks.aspx, and the task create action is defined in the UI.xml that calls the simple.ascx

    Best, -Don

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Oct 31, 2016 @ 15:57
    Dave Woestenborghs
    0

    Hi Don,

    I see you are using .NET user controls and webforms for building your custom application in the backend.

    Since Umbraco 7 the backend is built with Angular and it is also preferred that you extend it that way.

    I did a talk at 2014 Umbraco UK fest on building custom applications in Umbraco using Angular. Most of the concepts still apply.

    You can see the source code of the talk here : https://bitbucket.org/dawoe/umbukfestival2014

    And the video of the talk on Youtube : https://www.youtube.com/watch?v=_sX9eZSn9HI

    I also just found these video's on Youtube, but haven't watched them my self : https://www.youtube.com/watch?v=NY0OXGaCWVU&list=PLIJFrS8cNs2DagJaLFMTZn8oO11EbmL

    And if it's data in database tables you want to edit maybe this package can help you speed up the development : https://our.umbraco.org/projects/developer-tools/ui-o-matic/

    Dave

  • Don Nehc 69 posts 222 karma points
    Oct 31, 2016 @ 16:55
    Don Nehc
    0

    Thank you Dave for the info. I will look at them.

    Right now, I just need to get it to work as I am short on time.

    Best, -Don

Please Sign in or register to post replies

Write your reply to:

Draft