Hi,
While working in with XtraReport designer, I suddenly noticed that I couldn't show the preview anymore. When clicking on the preview button, I got a popup with the message from NullReferenceException. See the output :
C#A first chance exception of type 'System.InvalidCastException' occurred in ReportFactory.dll
A first chance exception of type 'System.InvalidCastException' occurred in ReportFactory.dll
'TrianonHRReport.Win.vshost.exe' (Managed (v4.0.30319)): Loaded 'n5jj2x4i'
15.10.15 11:15:55.131 ================================================================================
The error occurred:
Type: NullReferenceException
Message: La référence d'objet n'est pas définie à une instance d'un objet.
Data: 0 entries
Stack trace:
à DevExpress.XtraPrinting.Drawing.PageWatermark.DrawTextWatermark(IGraphics gr, RectangleF rect)
à DevExpress.XtraPrinting.Drawing.PageWatermark.Draw(IGraphics gr, RectangleF rect, Int32 pageIndex, Int32 pageCount)
à DevExpress.XtraPrinting.Drawing.Watermark.Draw(IGraphics gr, RectangleF rect, Int32 pageIndex, Int32 pageCount)
à DevExpress.XtraPrinting.BrickExporters.PageExporter.DrawWatermark(IGraphics gr, RectangleF rect)
à DevExpress.XtraPrinting.BrickExporters.PageExporter.DrawPage(IGraphics gr, PointF location)
à DevExpress.XtraPrinting.Page.DevExpress.DocumentView.IPage.Draw(Graphics gr, PointF position)
à DevExpress.XtraPrinting.Control.PrintControl.DrawPage(IPage page, Graphics graph, PointF position)
à DevExpress.DocumentView.Controls.DocumentViewerBase.DrawPages(PaintEventArgs e)
à DevExpress.DocumentView.Controls.DocumentViewerBase.view_Paint(Object sender, PaintEventArgs e)
à System.Windows.Forms.PaintEventHandler.Invoke(Object sender, PaintEventArgs e)
à System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
à System.Windows.Forms.Control.WmPaint(Message& m)
à System.Windows.Forms.Control.WndProc(Message& m)
à DevExpress.DocumentView.Controls.ViewControl.WndProc(Message& m)
à DevExpress.XtraPrinting.Preview.Native.WindowTargetBase.OnMessage(Message& m)
à System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException is null
The exception comes from XtraPrinting assembly. The result was a big red cross instead of the preview of my report.
Since the last line was about Watermark, I looked into the XtraReport properties to see if there's something wrong there. Watermark was in bold like if some modification has been done, but I could see no modification at all.
Then I openend the repx file in a texteditor and found only one line about watermark :
C#this.Watermark.Text = null;
I deleted this line and problem was solved, hurray !
I have no idea why such a "mistake" appeared in my repx. Regardless, I lost a lot some time and I think that the Assembly from DevExpress should handle this case in a better way. Can you please consider adding a more comprehensive message like "Watermark instance is missing" ? Or ignore properties definition when object is not instanciated ?
Thanks in advance for your response,
Best regards
Greg
Hi Greg,
I have forwarded this issue to our developers for further research. You will receive an automatic message once the status of this ticket is changed.