Copied to clipboard

Flag this post as spam?

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


  • Skowronek 29 posts 105 karma points
    May 09, 2014 @ 02:25
    Skowronek
    0

    IPublishedContentProperty.Value throwing error when being accessed more than one time

    I'm hoping someone can assist with a random anomaly. Yes, I realize Web Forms are "archaic", but that's what we're using...

    Running 6.2.0 includes reverting back to IPublishedContentProperty interface.

    For the sake of simplicity, say I have the following setup:

    MyUserControl1.ascx.cs

    public class MyUserControl1 : Umbraco.Web.UI.Controls.UmbracoUserControl
    {
        void Page_Load(object s, EventArgs e)
        {
            string bodyText = Umbraco.AssignedContentItem.GetProperty("bodyText").Value.ToString();
        }
    }

    MyUserControl2.ascx.cs

    public class MyUserControl2 : Umbraco.Web.UI.Controls.UmbracoUserControl
    {
        void Page_Load(object s, EventArgs e)
        {
            string bodyText = Umbraco.AssignedContentItem.GetProperty("bodyText").Value.ToString();
        }
    }

    When both controls are loaded onto the MasterPage, the following error is randomly thrown on the second call to .Value of the AssignedContentItem. I'm assuming it's due to blocking calls but I haven't found anything similar to this on any thread.

    Server Error in '/' Application.


    ValueFactory attempted to access the Value property of this instance.

    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.InvalidOperationException: ValueFactory attempted to access the Value property of this instance.


    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:


    [InvalidOperationException: ValueFactory attempted to access the Value property of this instance.]
      System.Lazy`1.CreateValue() +258
      System.Lazy`1.get_Value() +14277602
      Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedProperty.get_Value() +62



    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446

Please Sign in or register to post replies

Write your reply to:

Draft