Click on the banner to learn about and purchase my database training on Azure

Analysis Services - An error occurred while opening the model on the workspace database. Reason: An unexpected error occurred (file 'tmcachemanager.cpp', function 'TMCacheManager :: CreateEmptyCollectionsForAllParents')

Views: 542
Reading Time: 3 minutes

Speak guys !!
In this post I would like to share with you a problem (and the solution) that I had at work when I was trying to open the .BIM file for an Azure Analysis Services tabular cube project in Visual Studio 2019 and I came across the error message “ An error occurred while opening the model on the workspace database. Reason: An unexpected error occurred (file 'tmcachemanager.cpp', line 1790, function 'TMCacheManager :: CreateEmptyCollectionsForAllParents') ”.

problem description

This is a project that I had been working on for several weeks, and out of nowhere, I tried to open the BIM file and came across the error message below:

Message transcript:

An error occurred while opening the model on the workspace database. Reason: An unexpected error occurred (file 'tmcachemanager.cpp', line 1790, function 'TMCacheManager :: CreateEmptyCollectionsForAllParents').

============================
Call Stack:
============================

at Microsoft.AnalysisServices.VSHost.VSHostManager.PrepareSandbox (Boolean newProject, Boolean & isRefreshNeeded, Boolean & isImpersonationChanged, Boolean & saveRequired, List`1 & truncatedTables, Boolean isRealTimeMode, Int32 clientCompatibilityLevel)
at Microsoft.AnalysisServices.VSHost.Integration.EditorFactory.CreateEditorInstance (UInt32 grfCreateDoc, String pszMkDocument, String pszPhysicalView, IVsHierarchy pvHier, UInt32 itemid, IntPtr punkDocDataExist, IntPtr, Intptr, PtDDD, IntPtr & ppD

============================

I restarted Visual Studio, then restarted the machine and nothing worked.

I decided to search for a solution on Google before trying WhatsApp groups (Have you searched on Google?) and I only saw posts and links pointing to applying hotfixes and cumulative updates in Analysis Services.

As I was using Visual Studio 2019, with all available updates already installed, Azure Analysis Services, which always has the latest version, and my cube was at the Compatibility Level “SQL Server 2019 / Azure Analysis Services (1500)”, which it is also the most current, I discarded all these articles and posts, because none of them applied to my case.

Ready. Now I had no more reference links to help me.

Solution of the problem

To try to solve this problem, I started doing some tests on my own and one test that worked was to change the option from “Integrated Workspace Mode” to False:

This configuration means that Visual Studio does not use the local internal Analysis Services instance for development, but the original instance informed in the Cube configuration. This is often used to speed up the development step, and when you process the cube, the data is copied to that local instance as a cache, to allow you to view the data and test correctly when developing within Visual Studio.

After making this change, I was able to open the cube, although I received some error messages related to members and roles, but this is expected due to the change to no longer use the Integrated Workspace. In other words, disabling the Integrated Workspace allowed me to be able to open the BIM file, but it was not quite the solution I was hoping for, as I did not want to change the way I was developing the cube in Visual Studio.

Well, it gave me a light that the problem may not be corruption of the BIM file or the wrong configuration that I have done. I turned the “Integrated Workspace Mode” parameter back to True and tried to open the cube again: I received the same error message 🙁

After many, many tests, trials and errors, and more unsuccessful searches on the internet, it turned out that I finally found the solution to my problem: There was something wrong with the data cache or metadata that is loaded from the cube to the local internal instance of Analysis Services, so this serves to allow preview within Visual Studio.

To finally solve this problem that gave me a good headache for several minutes, I closed the solution in Visual Studio, opened the directory where my project and the BIM file were stored, removed the “obj” and “bin” subdirectories from my project folder and opened the solution again.

And voilá! My project started to open normally in Visual Studio.

The solution was very simple, even a little silly, but it's something that I spent a lot of time trying to solve, I didn't find any documentation on the internet that really helped me and I decided to share this problem and the solution with you.

That's it folks!
A big hug and even more !!