GetConsoleWindow used in Microsoft.AnalysisServices.retail 19.67.0 causing issues in Mono

Frits Jalvingh 0 Reputation points
2023-10-06T12:24:02.4966667+00:00

We have a C# program which uses TOM to synchronize an Analysis Services Model to individual Analysis Services instances on Azure. We have used this program for a few years now and run it daily for multiple servers on a Linux machine, using Mono.

This program now needs to be upgraded to be able to do the same for PowerBI Premium.

Most of the code works reasonably well, except when Annotations are used in the Model: in that case we get an error:

Microsoft.AnalysisServices.OperationException: Failed to save modifications to the server. Error returned: 'Unexpected column name: Received column '<ccon>ObjectID.Expression</ccon>' in rowset '<ccon>Annotations</ccon>'. Expected column '<ccon>ObjectID.Set</ccon>'.

As we were using quite an old version of the library that contained this (18.0.5) I tried to upgrade to 19.67.0. This, however, now throws a worse error:

System.TypeInitializationException: The type initializer for 'Microsoft.AnalysisServices.ConnectionInfo' threw an exception. ---> System.EntryPointNotFoundException: GetConsoleWindow assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Microsoft.AnalysisServices.Interop.NativeMethods.GetConsoleWindow()
  at Microsoft.AnalysisServices.Utilities.WindowsRuntimeHelper.IsProcessWithUserInterface () [0x00018] in <dd62e3e140ea4fa4877a34141e3d059c>:0 
  at Microsoft.AnalysisServices.Hosting.ClientHostingManager.UpdateProcessWithUserInterfaceStatus (System.Func`1[TResult] checkMethod) [0x00017] in <dd62e3e140ea4fa4877a34141e3d059c>:0 
  at Microsoft.AnalysisServices.ConnectionInfo..cctor () [0x000d1] in <dd62e3e140ea4fa4877a34141e3d059c>:0 

It appears that that GetConsoleWindow call is used to see whether the code runs in a console window - but this call is not at all supported by Mono as it is really a Windows platform call.

I am able to use version 19.2.0 in the meantime because this does seem to fix the Annotation issue and it does not have the GetWindowConsole problem - but I worry I will run into more trouble later which might require me to upgrade to one of the higher versions.

Can something be done to make that library no longer depend on that call? Or is there some workaround that I could use to be able to use that library? Is there a place where I could log a request for change on that library?

Regards && thanks for your time,

Frits

Azure Analysis Services
Azure Analysis Services
An Azure service that provides an enterprise-grade analytics engine.
443 questions
{count} votes

1 answer

Sort by: Most helpful
  1. BhargavaGunnam-MSFT 28,766 Reputation points Microsoft Employee
    2023-10-06T18:38:39.87+00:00

    Hello Frits Jalvingh,

    Welcome to the Microsoft Q&A forum.

    It seems like the latest version of the library 19.67.0 is not compatible with Mono due to the use of a Windows platform call. However, version 19.2.0 seems to work for you.

    You can submit a feature request in the Azure analysis service feedback forum below.

    https://feedback.azure.com/d365community/forum/d92323a0-0525-ec11-b6e6-000d3a4f0858

    All the feedback shared in this forum is actively monitored and reviewed by respective product owners. Please do share the feedback link once it is posted so that I can up-vote it, and will also pass the feedback to respective product owners.

    Hope this info helps.

    0 comments No comments