See the question and my original answer on StackOverflow

Here is a C# code that convert from WPF's BitmapSource to WinUI3 BitmapSource, using bitmap's pixels copy from one to the other.

public static async Task<Microsoft.UI.Xaml.Media.Imaging.SoftwareBitmapSource> GetWinUI3BitmapSourceFromWpfBitmapSource(System.Windows.Media.Imaging.BitmapSource bitmapSource)
    if (bitmapSource == null)
        return null;

    // get pixels as an array of bytes
    var stride = bitmapSource.PixelWidth * bitmapSource.Format.BitsPerPixel / 8;
    var bytes = new byte[stride * bitmapSource.PixelHeight];
    bitmapSource.CopyPixels(bytes, stride, 0);

    // get WinRT SoftwareBitmap
    var softwareBitmap = new Windows.Graphics.Imaging.SoftwareBitmap(

    // build WinUI3 SoftwareBitmapSource
    var source = new Microsoft.UI.Xaml.Media.Imaging.SoftwareBitmapSource();
    await source.SetBitmapAsync(softwareBitmap);
    return source;

Note that depending on how you got the "bitmap" (whatever format that is, GDI, WPF, etc), there may be smarter ways as this is allocating usually a 4 * width * height byte array for the whole bitmap.

Also, it would probably be good to review your threading issues, using WinRT all along is probably better.