SP-1973 avatar image
0 Votes"
SP-1973 asked azure-cxp-api edited

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

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

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SP-1973 , Thank you for reaching out. I have reached out to internal team to verify if this issue is because of any recent change. I will keep you posted as soon as I have a response from the team.

0 Votes 0 ·

1 Answer

KranthiPakala-MSFT avatar image
0 Votes"
KranthiPakala-MSFT answered KranthiPakala-MSFT commented

Hi @SP-7728 ,

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.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SP-1973,

Following up to see if you got a chance to see my previous suggestion. Please let us know how it goes.

0 Votes 0 ·

Hi @SP-1973,

Following up to see if the above suggestion was helpful. In case if you have found a different solution please do share it here with the community, as it will be beneficial for others.

0 Votes 0 ·