diff --git a/src/Uno.UI/UI/Xaml/Media/Imaging/RenderTargetBitmap.cs b/src/Uno.UI/UI/Xaml/Media/Imaging/RenderTargetBitmap.cs index 3bbbcfb68565..88562e5a5945 100644 --- a/src/Uno.UI/UI/Xaml/Media/Imaging/RenderTargetBitmap.cs +++ b/src/Uno.UI/UI/Xaml/Media/Imaging/RenderTargetBitmap.cs @@ -88,9 +88,7 @@ public IAsyncAction RenderAsync(UIElement? element, int scaledWidth, int scaledH try { UIElement elementToRender = element - ?? XamlRoot.Current.Content - ?? throw new global::System.NullReferenceException("Invalid XamlRoot Content."); - + ?? Window.Current.Content; (_bufferSize, PixelWidth, PixelHeight) = RenderAsBgra8_Premul(elementToRender, ref _buffer, new Size(scaledWidth, scaledHeight)); #if __WASM__ || __SKIA__ InvalidateSource(); @@ -111,8 +109,7 @@ public IAsyncAction RenderAsync(UIElement? element) try { UIElement elementToRender = element - ?? XamlRoot.Current.Content - ?? throw new global::System.NullReferenceException("Invalid XamlRoot Content."); + ?? Window.Current.Content; (_bufferSize, PixelWidth, PixelHeight) = RenderAsBgra8_Premul(elementToRender, ref _buffer); #if __WASM__ || __SKIA__