This is a normal behaviour.
In your case, the method returns its const defined return value.
virtual D2D1_SIZE_F GetSize() const = 0;
Most probably, the method fails inside, because the render target could not be "acquired" inside a BeginDraw/EndDraw
loop.
BeginDraw and EndDraw are used to indicate that a render target is in
use by the Direct2D system. Different implementations of
ID2D1RenderTarget might behave differently when BeginDraw is called.
An ID2D1BitmapRenderTarget may be locked between BeginDraw/EndDraw
calls, a DXGI surface render target might be acquired on BeginDraw and
released on EndDraw, while an ID2D1HwndRenderTarget may begin batching
at BeginDraw and may present on EndDraw, for example.
Remarks section:
ID2D1RenderTarget::BeginDraw method