Assembly aspects have not been initialized

avistokar's Avatar


02 Oct, 2017 12:34 PM

When I execute CachingServices.Invalidation.Invalidate(getPoliciesAsync) I get this message. At the very beginning of my WPF app (in the static ctor of App in app.xaml.cs) I call setup caching using CachingServices.DefaultBackend = new MemoryCachingBackend( new MemoryCache("myCache") );

This class is in a different assembly that the main executable with the App.xaml.cs that contains the above code. Is there a step I need to do for each assembly?

  1. Support Staff 1 Posted by PostSharp Techn... on 03 Oct, 2017 09:53 AM

    PostSharp Technologies's Avatar


    CachingServices.DefaultBackend is a property backed by a static field, so you have to initialize it once for the whole application (AppDomain).

    Please, could you check if CachingServices.Invalidation.Invalidate is not called from any static constructor?

    You can initialize the caching backend sooner than from WPF app static constructor by using a module initializer:

    public static void Initialize()
        CachingServices.DefaultBackend = new MemoryCachingBackend(new MemoryCache("myCache"));

    Please, what is the exact error message?

    Please, do you use multiple AppDomains in your app? If yes, then you have to initialize the caching backend for each AppDomain.


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac