Can not save Bitmap to MemoryStream
See original GitHub issueRepro
var img = new Bitmap(128, 128);
using var ms = new MemoryStream();
img.Save(ms, ImageFormat.Png);
StackTrace
at WinFormsComInterop.WinFormsComWrappers.ComputeVtables(Object, CreateComInterfaceFlags, Int32&) + 0x1af
at System.Runtime.InteropServices.ComWrappers.CreateCCW(Object, CreateComInterfaceFlags) + 0x39
at System.Runtime.InteropServices.ComWrappers.<>c__DisplayClass14_0.<GetOrCreateComInterfaceForObject>b__0(Object) + 0x1c
at System.Runtime.CompilerServices.ConditionalWeakTable2.GetValueLocked(TKey, ConditionalWeakTable
2.CreateValueCallback) + 0x2d
at System.Runtime.CompilerServices.ConditionalWeakTable2.GetValue(TKey, ConditionalWeakTable
2.CreateValueCallback) + 0x3e
at System.Runtime.InteropServices.ComWrappers.GetOrCreateComInterfaceForObject(Object, CreateComInterfaceFlags) + 0xa8
at System.Runtime.InteropServices.ComWrappers.ComInterfaceForObject(Object, Guid) + 0xe
at System.Drawing.SafeNativeMethods.Gdip.GdipSaveImageToStream(HandleRef, Interop.Ole32.IStream, Guid&, HandleRef) + 0xbd
at System.Drawing.Image.Save(Stream, ImageCodecInfo, EncoderParameters) + 0x144
at Test.Program.Main() + 0x8f
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Yes it works in normal and reflection-free mode
I update https://github.com/kant2002/NativeAOTImages to be more inline with changes. so my lib no longer needed. Let me know when you resolve issue.