D1181: EndDraw Incorrect State

EndDraw was called, but the rendertarget was not in a valid state. This may result from calling EndDraw without a matching BeginDraw.

 

Possible Causes

The application made multiple calls to EndDraw without calling BeginDraw on the same target. While using Direct2D, applications should match each call to EndDraw with a prior call to BeginDraw. Alternatively, this message may occur if the target is in an erroneous state and was not renderable.

Possible Fixes

Ensure that each call to BeginDraw is matched with a subsequent EndDraw. When submitting commands to a target using Flush or EndDraw, verify that the returned result is S_OK before attempting to use the target again.