I am using ReportingService2005 in a C#.net application that reaches out to an SSRS server to generate multiple reports as PDFs and combine them into a single PDF. It had worked well for a rough in-house program, but I recently deployed updated versions of old reports to be more flexible in some parameters. These reports were made by copying over tables from the old versions to maintain formatting, then updating the expressions to match the new report setup. One of these reports, in only very specific contexts that I can repeat if I encounter (but cannot determine what will trigger it), will fail to render in the program:
System.Web.Services.Protocols.SoapException - An error occurred during rendering of the report. --->
Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: An error occurred during rendering of the report. --->
Microsoft.ReportingServices.OnDemandReportRendering.ReportRenderingException: An error occurred during rendering of the report. --->
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException_NonExistingFieldReference: The expression referenced a non-existing field in the fields collection.
(Line breaks added to help with reading.) It doesn't say what field is being referenced or what element is failing, even if I try to analyze the SoapException in debug. If I look at a related dump log on the SSRS server, the report is:
library!ReportServer_0-113!248!03/21/2019-18:53:16:: e ERROR: Report server unique dump occured. Exception: Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: An error occurred during rendering of the report. ---> Microsoft.ReportingServices.OnDemandReportRendering.ReportRenderingException: An error occurred during rendering of the report. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException_NonExistingFieldReference: The expression referenced a non-existing field in the fields collection.
at Microsoft.ReportingServices.ReportProcessing.OnDemandReportObjectModel.FieldsImpl.CheckedGetFieldByIndex(Int32 index)
at Microsoft.ReportingServices.RdlExpressions.ReportRuntime.EvaluateSimpleFieldReference(Int32 fieldIndex, VariantResult& result)
at Microsoft.ReportingServices.RdlExpressions.ReportRuntime.EvaluateSimpleExpression(ExpressionInfo expression, VariantResult& result)
at Microsoft.ReportingServices.RdlExpressions.ReportRuntime.EvaluateTextRunValueExpression(TextRun textRun)
at Microsoft.ReportingServices.ReportProcessing.OnDemandReportObjectModel.TextRunImpl.GetResult(IReportScopeInstance romInstance)
at Microsoft.ReportingServices.OnDemandReportRendering.InternalTextRunInstance.EvaluateOriginalValue()
at Microsoft.ReportingServices.OnDemandReportRendering.InternalTextRunInstance.get_OriginalValue()
at Microsoft.ReportingServices.OnDemandReportRendering.TextBoxInstance.EvaluateOriginalValue()
at Microsoft.ReportingServices.OnDemandReportRendering.TextBoxInstance.get_TypeCode()
at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.GetAlignmentRight(Style style, StyleInstance styleInstance)
at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.InitParagraphs()
at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox..ctor(TextBox source, PageContext pageContext)
at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItem.Create(ReportItem source, Boolean tablixCellParent, Boolean ignoreKT, PageContext pageContext)
at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.AddRowMember(TablixMember rowMember, Int32 colIndex, Int32 rowSpan, Int32 colSpan, LevelInfo childInfo, PageContext pageContext, Double updateWidth)
at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.CreateRowMemberChildren(Tablix tablix, TablixMember rowMemberParent, Int32 defTreeLevel, Boolean parentBorderHeader, Int32 parentRowIndex, Int32 parentColIndex, Int32 sourceIndex, Boolean resetContext, Boolean parentHasFooters, LevelInfo parentLevelInfo, PageContext pageContext)
at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.CreateDynamicRowMemberChildren(Tablix tablix, TablixMember rowMemberParent, Int32 defTreeLevel, Int32 sourceIndex, Int32 parentRowIndex, Int32 parentColIndex, Boolean parentHasFooters, LevelInfo parentLevelInfo, PageContext pageContext)
at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.CreateTablixRows(Tablix tablix, TablixMember rowMemberParent, Int32 defTreeLevel, Boolean parentBord, Message: , Unhandled Exception: False
which doesn't seem to tell me any more except that the error occurs while trying to render a cell (which doesn't help, there's the header, footer, and a single tablix).
This same report, for the same parameters, will work fine in Visual Studio, ReportViewer through our website, the SSRS web interface, and even if I have the file render in this custom program as Excel instead of PDF. (Generating as PDF through the other interfaces also works fine.) I have combed the report's code for errant Field!
statements, particularly where a context is specified (e.g. another DataSet) and found nothing amiss.
I know that ReportingServices can make extremely esoteric error messages[1] so it's quite possible this isn't related to a non-existing field at all, but I can't figure out anything that might be wrong with the report or with the way that I'm calling to generate it. If I use a slightly different set of parameters, referring to a date range instead of a pre-defined time frame to get the same data, it generates fine; there is a column that doesn't get filled out in this case, making it a potential culprit, but again I can find nothing wrong.
Is there something I'm missing, or am I misunderstanding the error message? Is there another place that would actually tell me which frackin' cell has the error? The last-ditch solution for report problems has been to just recreate them wholly from scratch, but I would like to avoid this as the report is complex with a ton of tiny details.
Also, I noticed Edit: Nope, the cell that caused the problem was center-aligned, so this wouldn't have helped in this case.GetAlignmentRight
half-way through the trace; is this something that might help with debugging? If rendering calls Right/Center/Left I could very painfully narrow down the cell in question, if there even is one. I tried to change all of my right-aligned cells to center, though, and the trace did not change.
[1] another error message I dealt with in a different report said a non-existent ReportItem was being referenced, when the actual problem was timeout due to rendering taking too long; I've confirmed that's not the issue here