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)