如何打开Telerik Reports的日志记录?

时间:2012-07-10 13:05:01

标签: telerik-reporting

我有一个Telerik Report项目,它在ReportProcessor.RenderReport("PDF", reportToExport, null);方法的某处抛出NullReferenceException。我得到以下stacktrace:

System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Reporting.Processing.Table.MeasureColumns(Graphics graphics)
at Telerik.Reporting.Processing.Table.Measure(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.ProcessingElement.MeasureElement(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.ProcessingElement.Measure(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.ReportSectionBase.Measure(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.ProcessingElement.MeasureElement(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.Group.MeasureElement(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.Report.MeasureElement(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.ProcessingElement.Measure(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.ProcessingElement.MeasureElement(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.ProcessingElement.Measure(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.ReportSectionBase.Measure(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.ProcessingElement.MeasureElement(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.Group.MeasureElement(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.Report.MeasureElement(MeasureDirection dir, Graphics graphics)
at Telerik.Reporting.Processing.Report.MeasureElement(ProcessingElement elementToMeasure)
at Telerik.Reporting.Processing.ReportProcessor.RenderCore(String format, IList`1 reports, Hashtable deviceInfo, Hashtable renderingContext, CreateStream createStreamCallback)
at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRender(String format, IReportDocument reportDocument, Hashtable deviceInfo, Hashtable renderingContext, CreateStream createStreamCallback)
at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRenderStateless(String format, IReportDocument reportDocument, Hashtable deviceInfo, Hashtable renderingContext, CreateStream createStreamCallback)
at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo)
at JIIGCAL.CareerCompass.Reports.Views.ReportsDefault.ExportToPDF(IReportDocument reportToExport) in C:\dev\.....\Reports\Viewer.aspx.cs:line 236

Viewer.aspx.cs中的第236行是对RenderReport()的调用;我不知道如何追踪这个错误。有没有办法为运行时报告引擎启用日志记录,以便我可以获得有关哪个字段/列/表是有问题的更多信息?

编辑:找到解决方案

收到Telerik的以下回复:

  

如果Table单元格中的文本框为Size设置为零,则会发生此类错误。将大小从零更改为非常小的值可以解决问题。请注意,将行/列组设置为零大小会将它们设置为Visible = false,这是不受支持的。由于CrossTab / Table的数据驱动特性,当您想要隐藏某些数据时,您需要过滤CrossTab组而不是隐藏它们。

我根据某些条件将几个文本框设置为Visible = false。我改变了它,它完美地工作。

至于获取如何记录内部运行时引擎的结果,他们提出了以下建议:

  

启用任何.NET应用程序输出某些日志的标准方法是使用跟踪侦听器。例如,您可以将TextWriterTraceListener添加到应用程序的配置文件中:

<configuration>
  <system.diagnostics>
    <trace autoflush="false" indentsize="4">
      <listeners>
        <add name="myListener"
          type="System.Diagnostics.TextWriterTraceListener"
          initializeData="TextWriterOutput.log" />
        <remove name="Default" />
      </listeners>
    </trace>
  </system.diagnostics>
</configuration>
     

我们在报告引擎中使用相同的方法。您可以在Visual Studio输出窗口中看到我们所做的一些跟踪,您也可以下载产品源代码以供参考。

0 个答案:

没有答案