I have a problem with WriteableBitmap class in an application that combines the Direct3D (DrawingSurfaceBackgroundGrid) with Xaml. In my application I use Direct3D to draw map and Xaml to draw UI. Now I need create some popup pinned to the map. So I need texture of the popup. I want use WriteableBitmap.Render() + Invalidate() method to draw UI and then I will copy pixels to my texture in Direct3D render.
The problem is that WriteableBitmap.Render in this case does not work properly and the render results are more or less random. First timeWriteableBitmap.Render generates the correct bitmap. Second time generates an empty bitmap and third time it generates data that are neither UI nor empty. But when I "disconnect" Direct3Dfrom a page (DrawingSurfaceBackground.SetBackgroundContentProvider(nullptr)) andthe page looks line normal Xaml page without Direct3D, everithing works OK.
Important: This behavior occurs only when the application is running without debugger attached.