Bug Report T1279980
Visible to All Users

RichEditControl - NullReferenceException occurs when an SVG image is inserted

created 2 days ago (modified 2 days ago)

Steps to reproduce:

Refer to the attached project and video that illustrate the issue.

Expected results:

RichEditControl inserts an SVG image without errors

Current results:

RichEditControl throws NullReferenceException when an SVG image is inserted

Additional information:

Call Stack
PresentationCore.dll!System.Windows.Media.Imaging.BitmapDecoder.SetupDecoderFromUriOrStream(System.Uri uri, System.IO.Stream stream, System.Windows.Media.Imaging.BitmapCacheOption cacheOption, out System.Guid clsId, out bool isOriginalWritable, out System.IO.Stream uriStream, out System.IO.UnmanagedMemoryStream unmanagedMemoryStream, out Microsoft.Win32.SafeHandles.SafeFileHandle safeFilehandle) Unknown PresentationCore.dll!System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(System.Uri baseUri, System.Uri uri, System.IO.Stream stream, System.Windows.Media.Imaging.BitmapCreateOptions createOptions, System.Windows.Media.Imaging.BitmapCacheOption cacheOption, System.Net.Cache.RequestCachePolicy uriCachePolicy, bool insertInDecoderCache) Unknown PresentationCore.dll!System.Windows.Media.Imaging.BitmapImage.FinalizeCreation() Unknown > DevExpress.Xpf.RichEdit.v24.2.dll!DevExpress.XtraRichEdit.Drawing.XpfPainter.CreatePlatformImageSourceCore(DevExpress.Office.Utils.OfficeImage img) Line 544 C# DevExpress.Xpf.RichEdit.v24.2.dll!DevExpress.XtraRichEdit.Drawing.XpfPainter.CreatePlatformImageSource(DevExpress.Office.Utils.OfficeImage img, System.Drawing.Size targetSize) Line 504 C# DevExpress.Xpf.RichEdit.v24.2.dll!DevExpress.XtraRichEdit.Drawing.XpfPainter.ApplyImageBrushCore(System.Windows.Shapes.Rectangle rectangle, DevExpress.Office.Utils.OfficeImage img, System.Drawing.Size size) Line 424 C# DevExpress.Xpf.RichEdit.v24.2.dll!DevExpress.XtraRichEdit.Drawing.XpfPainter.ApplyImageBrush(System.Windows.Shapes.Rectangle rectangle, DevExpress.Office.Utils.OfficeImage img, System.Drawing.Rectangle bounds, DevExpress.XtraPrinting.ImageSizeMode sizing) Line 402 C# DevExpress.Xpf.RichEdit.v24.2.dll!DevExpress.XtraRichEdit.Drawing.XpfPainter.DrawImage(DevExpress.Office.Utils.OfficeImage img, System.Drawing.Rectangle bounds, DevExpress.XtraPrinting.ImageSizeMode sizing) Line 469 C# DevExpress.Xpf.RichEdit.v24.2.dll!DevExpress.XtraRichEdit.Drawing.XpfPainter.DrawImage(DevExpress.Office.Utils.OfficeImage img, System.Drawing.Rectangle bounds) Line 376 C#

Workaround:

C#
Document document = richEditControl1.Document; SvgImage svgImage = SvgImage.FromFile("folder.svg"); SvgBitmap svgBitmap = SvgBitmap.Create(svgImage); var bitmap = svgBitmap.Render(null, 1.0); DocumentImage picture = document.Images.Insert(document.Range.Start, DocumentImageSource.FromGdiImage(bitmap));

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.