Copied to clipboard

Flag this post as spam?

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


  • Richard Terris 273 posts 715 karma points
    Apr 22, 2015 @ 16:25
    Richard Terris
    0

    Resolution frozen....

    Hi all,

    I'm getting the error

    Resolution is not frozen, it is not yet possible to get values from it.

    I have a class which inherits from ApplicationEventHandler. When I remove this inheritance and comment out the two methods (ApplicationStarting and ApplicationStarted overrides) everything is fine, but as soon I put this back in I get the error.

    Stack trace:

    InvalidOperationException: Resolution is not frozen, it is not yet possible to get values from it.] Umbraco.Core.ObjectResolution.SingleObjectResolverBase2.get_Value() +410 Umbraco.Core.Services.ServiceContext.<.ctor>b__26() +27 System.Lazy1.CreateValue() +455 Umbraco.Core.Services.<>cDisplayClass3c.2b() +189 System.Lazy1.CreateValue() +14276544 System.Lazy1.LazyInitValue() +476 umbraco.BusinessLogic.User.GetUser(Int32 id) +42 Vega.USiteBuilder.Util.GetAdminUser() +31

    [TypeInitializationException: The type initializer for 'Vega.USiteBuilder.Util' threw an exception.] Vega.USiteBuilder.Util.GetCurrentUmbracoVersion() +24 Vega.USiteBuilder.UmbracoManager.SynchronizeIfNotSynchronized() +126 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165

    Any help will be greatly appreciated!

  • Gary Devenay 39 posts 245 karma points
    Apr 22, 2015 @ 16:28
    Gary Devenay
    1

    Does your Global.asax inherit from UmbracoApplication? If not I believe that can cause this error some times.

  • Richard Terris 273 posts 715 karma points
    Apr 22, 2015 @ 16:37
    Richard Terris
    0

    Deevny!

    I don't see a global.asax file but that said, there's a few classes in the solution which inherit from ApplicationEventHandler without issue.

    This was initially manifesting itself as an examine issue but now this so I'm really baffled as to where the actual issue is

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Apr 22, 2015 @ 17:11
    Matt Brailsford
    2

    Hey Rich,

    It sounds like something is happening in your Starting event handler which is trying to access the user service. Have you tried moving your "starting" code to the "started" event handler as within the started event handler, resolution should be frozen and the user service should be available.

    Matt

  • Richard Terris 273 posts 715 karma points
    Apr 22, 2015 @ 17:25
    Richard Terris
    0

    Hey Matt,

    Thanks for the response.

    No dice unfortunately.

    But your reply made me think... There are a number of classes in the solution which inherited ApplicationEventHandler so I checked all of those too.

    At the moment, my newest class which (I think) is causing the issue, has both the Started and Starting event handlers commented out but even with that being the case, if the class inherits from ApplicationEventHandler, this issue is still present.

    As for the other classes, they're all using the Started event with the exception of the ditto factory class which uses Starting.

    The newest class is where the problem started though so I assume it's that.

    To reiterate, in case this has now become confusing:

    • I have a number of classes inheriting from ApplicationEventHandler, all of which are using the ApplicationStarted event, not Starting
    • The newest class currently has the ApplicationEventHandler class named and the two event methods commented out and the issue is still happening

    I'm thoroughly confused! (though that's easily done :D )

  • Richard Terris 273 posts 715 karma points
    Apr 22, 2015 @ 17:46
    Richard Terris
    0

    Even more strangely now, when I take the ApplicationEventHandler out and comment out the event method(s) I am now getting redirected to an upgrade URL and it's sticking on that.

    Arrrgh!!!

  • Ravi Motha 290 posts 500 karma points MVP 7x c-trib
    Apr 22, 2015 @ 18:34
    Ravi Motha
    1

    Is it a case that the user service hasn't started following from Matts statement. Maybe you need to put a check in before you request anything from it.?

  • Richard Terris 273 posts 715 karma points
    Apr 23, 2015 @ 10:35
    Richard Terris
    0

    Hey guys,

    I was away last night by the time I got your responses. What I've tried this morning:

    • Since the class I was doing this in has the event handler and therefore ApplicationContext passed as a parameter, AND a separate context for another method, I wondered if things were getting confused by having two contexts available (I've seen this issue in plain MVC apps before). So I moved one method out into a separate class.
    • I think the stack trace was incorrect as you guys have been talking about user service but this code in particular is using the MediaService so I put a check in

      if(ApplicationContext.Current.Services.MediaService != null) MediaService.Saving += MediaServiceSaving;

    Neither of these things have fixed the issue, but I am back to getting errors related to Examine instead of the Resolution frozen error. I'm not sure if its the same issue bubbling up in different ways or 2 separate issues.

    I will appreciate any more ideas you guys have.

    R

  • Richard Terris 273 posts 715 karma points
    Apr 23, 2015 @ 10:42
    Richard Terris
    0

    Update:

    Now that I'm able to debug (wasn't able to before) I can see that it's the MediaService in this code which is throwing an exception.

    enter image description here

  • Richard Terris 273 posts 715 karma points
    Apr 23, 2015 @ 10:53
    Richard Terris
    100

    Final update.

    I removed the ApplicationContext instance that I was newing up and used the instance which is passed into the event handler and that's fixed it.

    So it looks like the application was getting confused with multiple contexts OR that the context I was newing up wasn't running properly.

    Thanks to all you guys for the help :)

Please Sign in or register to post replies

Write your reply to:

Draft