diff --git a/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php b/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
index 5ad5a844257..edb2e914085 100644
--- a/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
+++ b/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
@@ -13,6 +13,7 @@
 use Symfony\Component\DependencyInjection\Exception\RuntimeException;
 use Symfony\Component\DependencyInjection\Dumper\Dumper;
 use Symfony\Component\ExpressionLanguage\Expression;
+use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
 
 /**
  * OptimizedPhpArrayDumper dumps a service container as a serialized PHP array.
@@ -306,6 +307,9 @@ protected function dumpCollection($collection, &$resolve = FALSE) {
     $code = [];
 
     foreach ($collection as $key => $value) {
+      if ($value instanceof IteratorArgument) {
+        $value = $value->getValues();
+      }
       if (is_array($value)) {
         $resolve_collection = FALSE;
         $code[$key] = $this->dumpCollection($value, $resolve_collection);
diff --git a/core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php b/core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php
index a6fa2b9b09e..08451b11394 100644
--- a/core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php
+++ b/core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\Component\DependencyInjection\Dumper;
 
+use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -33,6 +34,9 @@ protected function dumpCollection($collection, &$resolve = FALSE) {
     $code = [];
 
     foreach ($collection as $key => $value) {
+      if ($value instanceof IteratorArgument) {
+        $value = $value->getValues();
+      }
       if (is_array($value)) {
         $code[$key] = $this->dumpCollection($value);
       }
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
index 9592a7fbfb6..965c59b8676 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
@@ -19,6 +19,7 @@
   use Symfony\Component\DependencyInjection\ContainerInterface;
   use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
   use Symfony\Component\DependencyInjection\Exception\RuntimeException;
+  use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
 
   /**
    * @coversDefaultClass \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper
@@ -357,6 +358,13 @@ public static function getDefinitionsDataProvider() {
         'arguments_expected' => static::getCollection([static::getIterator([static::getServiceCall('bar')])]),
       ] + $base_service_definition;
 
+      // Test an IteratorArgument collection with a reference to resolve.
+      $service_definitions[] = [
+        'arguments' => [new IteratorArgument([new Reference('bar')])],
+        'arguments_count' => 1,
+        'arguments_expected' => $this->getCollection([$this->getCollection([$this->getServiceCall('bar')])]),
+      ] + $base_service_definition;
+
       // Test a collection with a variable to resolve.
       $service_definitions[] = [
         'arguments' => [new Parameter('llama_parameter')],
