diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
index 2649aa7..3b9486f 100644
--- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php
+++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
@@ -156,6 +156,23 @@ public function getTitle(LocalTaskInterface $local_task) {
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function getDefinitions() {
+    $definitions =  parent::getDefinitions();
+
+    $count = 0;
+    foreach ($definitions as &$definition) {
+      if (isset($definition['weight'])) {
+        // Add some micro weight.
+        $definition['weight'] += ($count++) * 1e-6;
+      }
+    }
+
+    return $definitions;
+  }
+
+  /**
    * Find all local tasks that appear on a named route.
    *
    * @param string $route_name
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
index 6fc7c1c..9067e84 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
@@ -376,7 +376,7 @@ protected function getLocalTasksForRouteResult($mock_plugin) {
    */
   protected function getLocalTasksCache() {
     $local_task_fixtures = $this->getLocalTaskFixtures();
-    return array(
+    $local_tasks = array(
       'base_routes' => array(
         'menu_local_task_test_tasks_view' => 'menu_local_task_test_tasks_view',
       ),
@@ -396,6 +396,12 @@ protected function getLocalTasksCache() {
         ),
       ),
     );
+    $local_tasks['children']['> menu_local_task_test_tasks_view']['menu_local_task_test_tasks_settings']['weight'] = 0;
+    $local_tasks['children']['> menu_local_task_test_tasks_view']['menu_local_task_test_tasks_edit']['weight'] = 20 + 1e-6;
+    $local_tasks['children']['> menu_local_task_test_tasks_view']['menu_local_task_test_tasks_view.tab']['weight'] = 2e-6;
+    $local_tasks['children']['menu_local_task_test_tasks_view.tab']['menu_local_task_test_tasks_view_child1']['weight'] = 3e-6;
+    $local_tasks['children']['menu_local_task_test_tasks_view.tab']['menu_local_task_test_tasks_view_child2']['weight'] = 4e-6;
+    return $local_tasks;
   }
 
 }
