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 StackPresentationCore.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));