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

SP 1 Reputation point
2020-05-18T14:31:46.307+00:00

Hi,
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 18.7.0.1 but works when using an older version ( 18.4.0.5 ).
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 'http://schemas.microsoft.com/analysisservices/2003/engine' 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;"))
 {
            conn.Open();              
                try
                {
                   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);
                }
                finally
                {
                    conn.Close();
                }              

   }

Thank you

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

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,512 Reputation points Microsoft Employee
    2020-05-26T18:48:24.387+00:00

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.