Search code examples
c#ssmsssasxmla

SSAS sync with XMLA in C# - broken with SQL 2017


I have some C# code using the undocumented Microsoft.AnalysisServices.Xmla.dll library which has been working fine for SQL 2016 SSAS. I generate the XMLA script, and then do:

XmlaClient clnt = new XmlaClient();
clnt.Connect(@"server\instance");
string out = clnt.Send(syncxml, null);
clnt.Disconnect();

where syncxml is the XMLA script. This has been working fine for a long time. Now, with SQL 2017 SSAS instances, it throws an error "This database contains features that are not supported by the current edition of the server or the compatibility level of the database".

I upgraded the .dll to the latest version I could find (16.1.3.0) which certainly came out after SQL 2017.

I can sync the models without problem with SSMS 2017 and the script that the syncronise function in SSMS generates is identical to the syncxml in the code which gives the error above.

I assume it must be to do with the .dll version but I can't make this work with these 2017 instances. Both are version 14.0.249.2, compat level 1200.

Update: it works if I run the same code from a simple console app, it has stopped working in the ASP.NET Core app. Mysterious.


Solution

  • I finally found the real cause of this. I had this in the ASP.Net Core Startup.cs:

    var cultureInfo = new CultureInfo("en-US");
    CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
    

    In a mixed German/English environment, this was the problem. Removed these lines, redeployed the application and the problem disappeared. This is obviously a bug somewhere on the MS side. I noticed because manual runs of sync in SSMS were delivering SQL profiler messages in German but my failed syncs in English. I removed the above lines from the app, now the messages are in German but it works.