Screen not cleared when using UI with RenderSurface?

When I am rendering scene to texture and displaying only UI elements, screen doesn’t seem to be cleared:

The simplified code (in C# via UrhoSharp) producing this is following:

        Text helloText;

        protected override void Start()
        {
            helloText = new Text();
            helloText.SetFont(font: ResourceCache.GetFont("Fonts/Font.ttf"), size: 15);
            UI.Root.AddChild(helloText);

            var scene = new Scene();
            scene.CreateComponent<Octree>();

            var camera = scene.CreateChild("camera").CreateComponent<Camera>();

            var tx = new Texture2D();
            tx.SetSize(10, 10, Graphics.RGBFormat, TextureUsage.Rendertarget);

            var rs = tx.RenderSurface;
            rs.UpdateMode = RenderSurfaceUpdateMode.Updatealways;
            rs.SetViewport(0, new Viewport(scene, camera, null));
        }

        protected override void OnUpdate(float timeStep)
        {
            helloText.Value = ((char)(DateTime.Now.Second % 4 + 'A')).ToString();
        }

However when I the render surface part. The output is what I want:

What I am doing wrong? Is it a feature/bug of UrhoSharp/Urho3d?

This is a bug, or rather an unhandled situation. The Renderer checks if there are no views, and in that case it clears the screen each frame, instead of relying on the views overwriting the screen contents. However in this case there are views, though not backbuffer views. So it really should be checking that there is at least one active view that renders to the backbuffer, and if not, clear the screen.

Fixed in Urho master branch.

Thank you.