I am trying to generate html output of whole page and then pass it to response array.I am doing something like this:
`
      $page = array(
      '#theme' => 'html',
      '#page_object' => render($content),
       );`

here $content is a render array representing themed output of content.And then I am finally passing this `render($page)` to Response object. But I am getting error this error:

> LogicException: A stray drupal_render() invocation with $is_root_call = TRUE is causing bubbling of attached assets to break. in Drupal\Core\Render\Renderer->doRender() (line 377 of core\lib\Drupal\Core\Render\Renderer.php).

What should I do to make this correct? Thanks