diff --git a/core/lib/Drupal/Core/Session/AccountProxy.php b/core/lib/Drupal/Core/Session/AccountProxy.php
index 4d6db57..26a8a31 100644
--- a/core/lib/Drupal/Core/Session/AccountProxy.php
+++ b/core/lib/Drupal/Core/Session/AccountProxy.php
@@ -191,4 +191,12 @@ protected function loadUserEntity($account_id) {
     return \Drupal::entityManager()->getStorage('user')->load($account_id);
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function __sleep() {
+    trigger_error('The account proxy was serialized.', E_USER_ERROR);
+    return array_keys(get_object_vars($this));
+  }
+
 }
