Posts

Showing posts from February, 2023

Donate

PdfSharpCore And ImageSharp - Memory Keeps Increasing Or Memory Leak When Adding Hundreds Of Images To Create PDF Book

Image
Good day everyone! We are currently upgrading our WPF Cataloging application that has a feature to generate pdf books with multiple pages on the fly and each book may contain thirty or more images and may reach even a hundred from .NET Framework to .NET 7. Upon printing of a book,we discovered that it consume lots of memory even reaching to 5GB per book. Because our logic in generating a catalog involves adding texts and loading several images in memory and then print those details on a single pdf file, it may have caused to memory usage to skyrocket at a tremendous result. The code below shows how we load images using PdfSharpCore and ImageSharp. private ImageSource.IImageSource GetImageFromList<TPixel>( string key, string which, string name) where TPixel : unmanaged, IPixel<TPixel> { ImageSource.IImageSource rtn; int width; int height; width = 0; height = 0; if (ImageList.ContainsKey(key)) { rtn = ImageList[key]; } else { if (Ima

Xamarin Forms - Waiting for the emulator is ready In Visual Studio 2019

Image
Hello, I've experienced this error lately when running my Xamarin Forms project. The emulator loads on screen without the UI and in Visual Studio's output window, it says Waiting for the emulator is ready. It's just like waiting for the emulator to load forever. After trying out some accepted solutions, deleting and adding back the emulator works for me. First is to open the Android Device manager in Visual Studio IDE. Go to Tools Menu -> Android -> Android Device Manager. Delete the existing emulator and add it back again. In my current setup it's " Pixel 2 Pie 9.0 - API 28 ". After deleting and adding back the emulator, my Xamarin Forms app shows in the emulator. Cheers!

Donate