diff --git a/pathauto.module b/pathauto.module
index 4b479f8..8cb501c 100644
--- a/pathauto.module
+++ b/pathauto.module
@@ -58,7 +58,7 @@ function pathauto_help($route_name, RouteMatchInterface $route_match) {
       $output .= '<dd>' . t('The <a href=":pathauto_pattern">"Patterns"</a> page is used to configure automatic path aliasing.  New patterns are created here using the <a href=":add_form">Add Pathauto pattern</a> button which presents a form to simplify pattern creation thru the use of <a href="token">available tokens</a>. The patterns page provides a list of all patterns on the site and allows you to edit and reorder them.', [':pathauto_pattern' => Url::fromRoute('entity.pathauto_pattern.collection')->toString(), ':add_form' => Url::fromRoute('entity.pathauto_pattern.add_form')->toString()]) . '</dd>';
       $output .= '<dt>' . t('Pathauto Settings') . '</dt>';
       $output .= '<dd>' . t('The <a href=":settings">"Settings"</a> page is used to customize global Pathauto settings for automated pattern creation.', [':settings' => Url::fromRoute('pathauto.settings.form')->toString()]) . '</dd>';
-      $output .= '<dd>' . t('The <strong>maximum alias length</strong> and <strong>maximum component length</strong> values default to 100 and have a limit of @max from Pathauto. This length is limited by the length of the "alias" column of the url_alias database table. The default database schema for this column is @max. If you set a length that is equal to that of the one set in the "alias" column it will cause problems in situations where the system needs to append additional words to the aliased URL. You should enter a value that is the length of the "alias" column minus the length of any strings that might get added to the end of the URL. The length of strings that might get added to the end of your URLs depends on which modules you have enabled and on your Pathauto settings. The recommended and default value is 100.') . '</dd>';
+      $output .= '<dd>' . t('The <strong>maximum alias length</strong> and <strong>maximum component length</strong> values default to 100 and have a limit of 255 from Pathauto. This length is limited by the length of the "alias" column of the url_alias database table. The default database schema for this column is 255. If you set a length that is equal to that of the one set in the "alias" column it will cause problems in situations where the system needs to append additional words to the aliased URL. You should enter a value that is the length of the "alias" column minus the length of any strings that might get added to the end of the URL. The length of strings that might get added to the end of your URLs depends on which modules you have enabled and on your Pathauto settings. The recommended and default value is 100.') . '</dd>';
       $output .= '<dt>' . t('Bulk Generation') . '</dt>';
       $output .= '<dd>' . t('The <a href=":pathauto_bulk">"Bulk Generate"</a> page allows you to create URL aliases for items that currently have no aliases. This is typically used when installing Pathauto on a site that has existing un-aliased content that needs to be aliased in bulk.', [':pathauto_bulk' => Url::fromRoute('pathauto.bulk.update.form')->toString()]) . '</dd>';
       $output .= '<dt>' . t('Delete Aliases') . '</dt>';
diff --git a/pathauto.services.yml b/pathauto.services.yml
index 3d3a760..748de19 100644
--- a/pathauto.services.yml
+++ b/pathauto.services.yml
@@ -10,7 +10,7 @@ services:
     arguments: ['@config.factory', '@path.alias_storage', '@database','@pathauto.verbose_messenger', '@string_translation']
   pathauto.alias_uniquifier:
     class: Drupal\pathauto\AliasUniquifier
-    arguments: ['@config.factory', '@pathauto.alias_storage_helper','@module_handler', '@router.route_provider', '@path.alias_manager']
+    arguments: ['@config.factory', '@pathauto.alias_storage_helper','@module_handler', '@router.no_access_checks', '@path.alias_manager']
   pathauto.verbose_messenger:
     class: Drupal\pathauto\VerboseMessenger
     arguments: ['@config.factory', '@current_user']
diff --git a/src/AliasUniquifier.php b/src/AliasUniquifier.php
index 98ac166..902a03e 100644
--- a/src/AliasUniquifier.php
+++ b/src/AliasUniquifier.php
@@ -12,7 +12,9 @@ use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Path\AliasManagerInterface;
-use Drupal\Core\Routing\RouteProviderInterface;
+use Drupal\Core\Path\AliasStorageInterface;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
+use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
 
 /**
  * Provides a utility for creating a unique path alias.
@@ -41,11 +43,11 @@ class AliasUniquifier implements AliasUniquifierInterface {
   protected $moduleHandler;
 
   /**
-   * The route provider service.
+   * The url matcher service.
    *
-   * @var \Drupal\Core\Routing\RouteProviderInterface.
+   * @var \Symfony\Component\Routing\Matcher\UrlMatcherInterface
    */
-  protected $routeProvider;
+  protected $urlMatcher;
 
   /**
    * The alias manager.
@@ -55,6 +57,15 @@ class AliasUniquifier implements AliasUniquifierInterface {
   protected $aliasManager;
 
   /**
+   * Stores the last matching route name.
+   *
+   * Used to prevent a loop if the same route matches a given pattern.
+   *
+   * @var
+   */
+  protected $lastRouteName;
+
+  /**
    * Creates a new AliasUniquifier.
    *
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
@@ -63,14 +74,14 @@ class AliasUniquifier implements AliasUniquifierInterface {
    *   The alias storage helper.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
-   * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
-   *   The route provider service.
+   * @param \Symfony\Component\Routing\Matcher\UrlMatcherInterface $url_matcher
+   *   The url matcher service.
    */
-  public function __construct(ConfigFactoryInterface $config_factory, AliasStorageHelperInterface $alias_storage_helper, ModuleHandlerInterface $module_handler, RouteProviderInterface $route_provider, AliasManagerInterface $alias_manager) {
+  public function __construct(ConfigFactoryInterface $config_factory, AliasStorageHelperInterface $alias_storage_helper, ModuleHandlerInterface $module_handler, UrlMatcherInterface $url_matcher, AliasManagerInterface $alias_manager) {
     $this->configFactory = $config_factory;
     $this->aliasStorageHelper = $alias_storage_helper;
     $this->moduleHandler = $module_handler;
-    $this->routeProvider = $route_provider;
+    $this->urlMatcher = $url_matcher;
     $this->aliasManager = $alias_manager;
   }
 
@@ -156,17 +167,20 @@ class AliasUniquifier implements AliasUniquifierInterface {
       return TRUE;
     }
 
-    $routes = $this->routeProvider->getRoutesByPattern($path);
+    try {
+      $route = $this->urlMatcher->match($path);
 
-    // Only return true for an exact match, ignore placeholders.
-    foreach ($routes as $route) {
-      if ($route->getPath() == $path) {
-        return TRUE;
+      if ($route['_route'] == $this->lastRouteName) {
+        throw new \InvalidArgumentException('The path "' . $path . '" collides with the route with identifier ' . $this->lastRouteName . ', whose path is ' . $route['_route_object']->getPath());
       }
-    }
-
-    return FALSE;
 
+      $this->lastRouteName = $route['_route'];
+      return TRUE;
+    }
+    catch (ResourceNotFoundException $e) {
+      $this->lastRouteName = NULL;
+      return FALSE;
+    }
   }
 
 }
diff --git a/src/Tests/PathautoLocaleTest.php b/src/Tests/PathautoLocaleTest.php
index ba1e3c7..7ec7c78 100644
--- a/src/Tests/PathautoLocaleTest.php
+++ b/src/Tests/PathautoLocaleTest.php
@@ -83,9 +83,9 @@ class PathautoLocaleTest extends WebTestBase {
     // specifying a language.
     $node = $this->drupalCreateNode(array('title' => 'English node', 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED));
 
-    // Check that the new node had a unique alias generated with the '-0'
+    // Check that the new node had a unique alias generated with the '-1'
     // suffix.
-    $this->assertEntityAlias($node, '/content/english-node-0', LanguageInterface::LANGCODE_NOT_SPECIFIED);
+    $this->assertEntityAlias($node, '/content/english-node-1', LanguageInterface::LANGCODE_NOT_SPECIFIED);
   }
 
   /**
diff --git a/src/Tests/PathautoNodeWebTest.php b/src/Tests/PathautoNodeWebTest.php
index add4dfa..825b679 100644
--- a/src/Tests/PathautoNodeWebTest.php
+++ b/src/Tests/PathautoNodeWebTest.php
@@ -87,7 +87,7 @@ class PathautoNodeWebTest extends WebTestBase {
       'path[0][pathauto]' => FALSE,
       'path[0][alias]' => $manual_alias,
     );
-    $this->drupalPostForm($node->toUrl('edit-form'), $edit, t('Save and keep published'));
+    $this->drupalPostForm($node->urlInfo('edit-form'), $edit, t('Save and keep published'));
     $this->assertRaw(t('@type %title has been updated.', array('@type' => 'page', '%title' => $title)));
 
     // Check that the automatic alias checkbox is now unchecked by default.
@@ -139,7 +139,7 @@ class PathautoNodeWebTest extends WebTestBase {
     $node = $this->drupalGetNodeByTitle($edit['title']);
 
     // Pathauto checkbox should still not exist.
-    $this->drupalGet($node->toUrl('edit-form'));
+    $this->drupalGet($node->urlInfo('edit-form'));
     $this->assertNoFieldById('edit-path-0-pathauto');
     $this->assertFieldByName('path[0][alias]', '');
     $this->assertNoEntityAlias($node);
@@ -285,4 +285,28 @@ class PathautoNodeWebTest extends WebTestBase {
     $this->assertResponse(200);
   }
 
+  /**
+   * Tests that patterns can coexist with routes with arguments.
+   *
+   * A common case is to have a view with a term name as a contextual filter,
+   * and a pattern that matches the view's path.
+   */
+  public function testPatternMatchingDynamicRoute() {
+    $this->drupalLogin($this->rootUser);
+
+    // Create a pattern for nodes that matches with a view path defined at
+    // pathauto_views_test module.
+    $this->createPattern('node', '/articles/[node:title]', -1);
+
+    // Create an article.
+    $edit = array(
+      'title[0][value]' => 'Sample article',
+    );
+    $this->drupalPostForm('node/add/article', $edit, t('Save and publish'));
+
+    // Check that the alias was not created and an alert was shown.
+    $this->assertText('collides with the route with identifier');
+    $this->assertNoAliasExists(array('alias' => '/articles/sample-article'));
+  }
+
 }
diff --git a/src/Tests/PathautoTestHelperTrait.php b/src/Tests/PathautoTestHelperTrait.php
index 14c7ea4..705920b 100644
--- a/src/Tests/PathautoTestHelperTrait.php
+++ b/src/Tests/PathautoTestHelperTrait.php
@@ -14,8 +14,6 @@ use Drupal\Core\Render\BubbleableMetadata;
 use Drupal\pathauto\Entity\PathautoPattern;
 use Drupal\pathauto\PathautoPatternInterface;
 use Drupal\taxonomy\VocabularyInterface;
-use Drupal\taxonomy\Entity\Vocabulary;
-use Drupal\taxonomy\Entity\Term;
 
 /**
  * Helper test class with some added functions for testing.
@@ -90,7 +88,7 @@ trait PathautoTestHelperTrait {
     if (!$langcode) {
       $langcode = $entity->language()->getId();
     }
-    return $this->saveAlias('/' . $entity->toUrl()->getInternalPath(), $alias, $langcode);
+    return $this->saveAlias('/' . $entity->urlInfo()->getInternalPath(), $alias, $langcode);
   }
 
   public function assertEntityAlias(EntityInterface $entity, $expected_alias, $langcode = NULL) {
@@ -98,11 +96,11 @@ trait PathautoTestHelperTrait {
     if (!$langcode) {
       $langcode = $entity->language()->getId();
     }
-    $this->assertAlias('/' . $entity->toUrl()->getInternalPath(), $expected_alias, $langcode);
+    $this->assertAlias('/' . $entity->urlInfo()->getInternalPath(), $expected_alias, $langcode);
   }
 
   public function assertEntityAliasExists(EntityInterface $entity) {
-    return $this->assertAliasExists(array('source' => '/' . $entity->toUrl()->getInternalPath()));
+    return $this->assertAliasExists(array('source' => '/' . $entity->urlInfo()->getInternalPath()));
   }
 
   public function assertNoEntityAlias(EntityInterface $entity, $langcode = NULL) {
@@ -110,11 +108,11 @@ trait PathautoTestHelperTrait {
     if (!$langcode) {
       $langcode = $entity->language()->getId();
     }
-    $this->assertEntityAlias($entity, '/' . $entity->toUrl()->getInternalPath(), $langcode);
+    $this->assertEntityAlias($entity, '/' . $entity->urlInfo()->getInternalPath(), $langcode);
   }
 
   public function assertNoEntityAliasExists(EntityInterface $entity, $alias = NULL) {
-    $path = array('source' => '/' . $entity->toUrl()->getInternalPath());
+    $path = array('source' => '/' . $entity->urlInfo()->getInternalPath());
     if (!empty($alias)) {
       $path['alias'] = $alias;
     }
@@ -153,7 +151,7 @@ trait PathautoTestHelperTrait {
       'name' => $name,
       'vid' => $name,
     );
-    $vocabulary = Vocabulary::create($values);
+    $vocabulary = entity_create('taxonomy_vocabulary', $values);
     $vocabulary->save();
 
     return $vocabulary;
@@ -165,7 +163,7 @@ trait PathautoTestHelperTrait {
       'vid' => $vocabulary->id(),
     );
 
-    $term = Term::create($values);
+    $term = entity_create('taxonomy_term', $values);
     $term->save();
     return $term;
   }
diff --git a/tests/src/Kernel/PathautoKernelTest.php b/tests/src/Kernel/PathautoKernelTest.php
index e503bc3..42e29c2 100644
--- a/tests/src/Kernel/PathautoKernelTest.php
+++ b/tests/src/Kernel/PathautoKernelTest.php
@@ -21,8 +21,6 @@ use Drupal\pathauto\Tests\PathautoTestHelperTrait;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\taxonomy\Entity\Term;
 use Drupal\taxonomy\Entity\Vocabulary;
-use Drupal\node\Entity\Node;
-use Drupal\user\Entity\User;
 
 /**
  * Unit tests for Pathauto functions.
@@ -70,7 +68,7 @@ class PathautoKernelTest extends KernelTestBase {
 
     \Drupal::service('router.builder')->rebuild();
 
-    $this->currentUser = User::create(array('name' => $this->randomMachineName()));
+    $this->currentUser = entity_create('user', array('name' => $this->randomMachineName()));
     $this->currentUser->save();
   }
 
@@ -167,29 +165,6 @@ class PathautoKernelTest extends KernelTestBase {
   }
 
   /**
-   * Test potential conflicts with the same alias in different languages.
-   */
-  public function testSameTitleDifferentLanguages() {
-    // Create two English articles with the same title.
-    $edit = [
-      'title' => 'Sample page',
-      'type' => 'page',
-      'langcode' => 'en',
-    ];
-    $node1 = $this->drupalCreateNode($edit);
-    $this->assertEntityAlias($node1, '/content/sample-page', 'en');
-
-    $node2 = $this->drupalCreateNode($edit);
-    $this->assertEntityAlias($node2, '/content/sample-page-0', 'en');
-
-    // Now, create a French article with the same title, and verify that it gets
-    // the basic alias with the correct langcode.
-    $edit['langcode'] = 'fr';
-    $node3 = $this->drupalCreateNode($edit);
-    $this->assertEntityAlias($node3, '/content/sample-page', 'fr');
-  }
-
-  /**
    * Test pathauto_cleanstring().
    */
   public function testCleanString() {
@@ -294,7 +269,7 @@ class PathautoKernelTest extends KernelTestBase {
     $node->setTitle('Third title');
     $node->save();
     $this->assertEntityAlias($node, '/content/third-title');
-    $this->assertAliasExists(array('source' => '/' . $node->toUrl()->getInternalPath(), 'alias' => '/content/second-title'));
+    $this->assertAliasExists(array('source' => '/' . $node->urlInfo()->getInternalPath(), 'alias' => '/content/second-title'));
 
     $config->set('update_action', PathautoGeneratorInterface::UPDATE_ACTION_DELETE);
     $config->save();
@@ -303,7 +278,7 @@ class PathautoKernelTest extends KernelTestBase {
     $this->assertEntityAlias($node, '/content/fourth-title');
     $this->assertNoAliasExists(array('alias' => '/content/third-title'));
     // The older second alias is not deleted yet.
-    $older_path = $this->assertAliasExists(array('source' => '/' . $node->toUrl()->getInternalPath(), 'alias' => '/content/second-title'));
+    $older_path = $this->assertAliasExists(array('source' => '/' . $node->urlInfo()->getInternalPath(), 'alias' => '/content/second-title'));
     \Drupal::service('path.alias_storage')->delete($older_path);
 
     $config->set('update_action', PathautoGeneratorInterface::UPDATE_ACTION_NO_NEW);
@@ -461,7 +436,7 @@ class PathautoKernelTest extends KernelTestBase {
     $edit['pass']   = user_password();
     $edit['path'] = array('pathauto' => TRUE);
     $edit['status'] = 1;
-    $account = User::create($edit);
+    $account = entity_create('user', $edit);
     $account->save();
     $this->assertEntityAlias($account, '/users/test-user');
   }
@@ -524,7 +499,7 @@ class PathautoKernelTest extends KernelTestBase {
       'type'      => 'page',
     );
 
-    $node = Node::create($settings);
+    $node = entity_create('node', $settings);
     $node->save();
 
     return $node;
