ADOMD. Net Product Version trows exception when extracting data from Azure Analysis Service

SP 1 Reputation point

I’m using ADOMD. Net to execute a MDX query in Azure Analysis Service. The code worked fine until recently, but stopped working when the new version of ADOMD was installed on the computer. I tried on two systems: one has Net Framework 4.5 installed and the other has Net Framework 4.7.
The code throws an exception when using the ADOMD.Net Product version but works when using an older version ( ).
Are there new prerequisites for this version of ADOMD.Net?

The error I get is this:

System.Xml.XmlException: Prefix '' is already assigned to namespace 'urn:schemas-microsoft-com:xml-analysis:mddataset' and cannot be reassigned to '' on this tag.
   at System.Xml.XmlSqlBinaryReader.QName.CheckPrefixNS(String prefix, String namespaceUri)
   at System.Xml.XmlSqlBinaryReader.PushNamespace(String prefix, String ns, Boolean implied)
   at System.Xml.XmlSqlBinaryReader.ScanAttributes()
   at System.Xml.XmlSqlBinaryReader.ImplReadElement()
   at System.Xml.XmlSqlBinaryReader.ReadDoc()
   at System.Xml.XmlSqlBinaryReader.Read()
   at System.Xml.XmlReader.ReadEndElement()
   at Microsoft.AnalysisServices.AdomdClient.XmlaReader.ReadEndElement()
   at Microsoft.AnalysisServices.AdomdClient.FormattersHelpers.ReadDataSetProperty(XmlReader reader, Type type)
   at Microsoft.AnalysisServices.AdomdClient.MDDatasetFormatter.ReadCubeInfo(XmlReader reader)
   at Microsoft.AnalysisServices.AdomdClient.MDDatasetFormatter.ReadOlapInfo(XmlReader reader)
   at Microsoft.AnalysisServices.AdomdClient.MDDatasetFormatter.ReadMDDataset(XmlReader reader)
   at Microsoft.AnalysisServices.AdomdClient.SoapFormatter.ReadDataSetResponsePrivate(XmlReader reader)
   at Microsoft.AnalysisServices.AdomdClient.SoapFormatter.ReadExecuteResponsePrivate(XmlReader reader, InlineErrorHandlingType inlineErrorHandling)
   at Microsoft.AnalysisServices.AdomdClient.SoapFormatter.ReadResponse(XmlReader reader, InlineErrorHandlingType inlineErrorHandling)

The code use to replicate is a very simple:

 using (AdomdConnection conn = new AdomdConnection(@"Password=myPass;Persist Security Info=True;User ID=myUser;Initial Catalog=adventureworks;Data Source=asazure://myAzure/myASAzure;"))
                   AdomdCommand cmd = new AdomdCommand(@"SELECT  {[Product Category].[Product Category Name].members}  ON 0 FROM  [Model]", conn);              
                    CellSet cs = cmd.ExecuteCellSet();
                    TupleCollection tuplesOnColumns = cs.Axes[0].Set.Tuples;
                    int colCount = tuplesOnColumns.Count;
                    for (int col = 0; col < colCount; col++)
                        result.Append(tuplesOnColumns[col].Members[0].Name).AppendLine() ;  
                     MessageBox.Show(this, result.ToString());
                catch (Exception ex)
                    MessageBox.Show(this, "Error :" + ex.Message+ Environment.NewLine +ex.InnerException+Environment.NewLine + ex.ToString() + Environment.NewLine + ex.StackTrace);


Thank you

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

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,442 Reputation points Microsoft Employee

    Hi @SP ,

    Sorry for the late response. Could you please try setting Protocol Format=XML in the connection string and see if it helps to resolve the issue.
    Let us know if you still experience the issue.