XmlReader for CellSet throws exception with version 14+ of AdomdClient.dll

Kobi Averbuch 1 Reputation point
2020-10-14T09:55:57.82+00:00

We use Microsoft.AnalysisServices.AdomdClient.dll version 14+ (works fine with 13),

we execute cmd.ExecuteXmlReader, read the xml, then place it into another xmlreader, then load it into cellset (the code below).
Works fine with most queries, but, When ssas returns xmla result as below (with errors in some cells), the load into cellset fails

the reason we do this extra step is that performance of standard poulation of cellset becomes VERY slow for large data sets (compared to com adom performance). as in many cases we need only the first N rows, we go through the reader and take the cells for the first N rows, close it correctly and reload it into the cellset. as I said, worked fine, until version 14+ when having cells with errors.

xml sample

<CellData>

   <Cell CellOrdinal="0">  

          <Value xsi:type="xsd:decimal">35672047.9045</Value>  

          <FmtValue>$35,672,047.90</FmtValue>  

          <FormatString>Currency</FormatString>  

   </Cell>  

   <Cell CellOrdinal="1">  

          <Value xsi:type="xsd:decimal">3278970.3518</Value>  

          <FmtValue>$3,278,970.35</FmtValue>  

          <FormatString>Currency</FormatString>  

   </Cell>  

   <Cell CellOrdinal="2">  

          <Value>  

                 <Error>  

                       <ErrorCode>3238658259</ErrorCode>  

                       <Description>The MDX function CURRENTMEMBER failed because the coordinate for the 'Fiscal Year' attribute contains a set.</Description>  

                 </Error>  

          </Value>  

          <FmtValue>  

                 <Error>  

                       <ErrorCode>3238658259</ErrorCode>  

                       <Description>The MDX function CURRENTMEMBER failed because the coordinate for the 'Fiscal Year' attribute contains a set.</Description>  

                 </Error>  

          </FmtValue>  

          <FormatString>#,##0</FormatString>  

   </Cell>  

</CellData>

I use sample code from “Retrieving Data Using the XmlReader” article

https://learn.microsoft.com/en-us/analysis-services/adomd/multidimensional-models-adomd-net-client/retrieving-data-using-the-xmlreader?view=asallproducts-allversions

code sample
//1. Execute the command, retrieving an XmlReader.

System.Xml.XmlReader reader = cmd.ExecuteXmlReader();

//2. Do something with the reader: Parse data, Parse metadata,

// Save for later loading into CellSet, etc.

fullXml = reader.ReadOuterXml();

after this I create new XmlReader and try loadind into CellSet as:

//3. Create new reader from old xml

XmlReader newReader = XmlReader.Create(new StringReader(fullXml));

//4. Load the CellSet with the specified XML

CellSet cs = CellSet.LoadXml(newReader);

The error

System.NullReferenceException: Object reference not set to an instance of an object.

at Microsoft.AnalysisServices.AdomdClient.XmlaClient.ReadInlineError(XmlReader reader, String errorNamespace)

at Microsoft.AnalysisServices.AdomdClient.XmlaClient.CheckAndGetInlineError(XmlReader reader, Boolean throwIfError, String errorNamespace)

at Microsoft.AnalysisServices.AdomdClient.FormattersHelpers.ReadDataSetProperty(XmlReader reader, Type type)

at Microsoft.AnalysisServices.AdomdClient.MDDatasetFormatter.ReadCells(XmlReader reader)

at Microsoft.AnalysisServices.AdomdClient.MDDatasetFormatter.ReadMDDataset(XmlReader reader)

at Microsoft.AnalysisServices.AdomdClient.SoapFormatter.ReadDataSetResponsePrivate(XmlReader reader)

at Microsoft.AnalysisServices.AdomdClient.SoapFormatter.ReadDataSetResponse(XmlReader reader)

at Microsoft.AnalysisServices.AdomdClient.CellSet.LoadXml(XmlReader xmlTextReader)

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,263 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Lukas Yu -MSFT 5,821 Reputation points
    2020-10-15T07:36:14.98+00:00

    Not sure what inside AdomdClient logic, and there is actually not document on this. Seems like the version 14 adomdclient could not handle the error or blank in this scene.

    Have you try the newest version ?Try Analysis Services client libraries


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Kobi Averbuch 1 Reputation point
    2020-10-15T09:14:04.553+00:00

    Yes, we have downloaded the latest from that site
    when i said version 15, it is the version of the adomdclient dll

    0 comments No comments

  3. Lukas Yu -MSFT 5,821 Reputation points
    2020-10-23T07:14:04.57+00:00

    Still not find any document or other report related to this change, not sure what was changed inside. Could we try to use old version if it works fine.