RenderTexture not showing UI elements

I want to take a screentshot from UI elements inside a canvas in screen space-overlay render mode. So I added a renderTexture to the main camera. If I change the render mode to World Space then UI elements show up. What is happening and why the UI layer is not being rendered by camera in space-overlay?

Found the issue:
Unity Issue Tracker - RenderTextures do not include Canvas (UI) elements
It is intended to do that by design.
To solve this you have to call Render before taking the screenshot so UI is forced draw.

Camera.main.renderTexture = myRenderTexture;
Camera.main.Render();
Caemra.main.renderTexture = null;

so it forces to render the UI layer.

Yes I have this problem too. In screen space overlay camera can not show ui elements dynamically neither statically. I’m still searching for a solution.