Sitecore 10 Identity Azure AD ExternalUserBuilder No matching constructor was found - Error Fix

Issue

While building a custom external user builder for Sitecore 10 with Azure AD integration for Sitecore Identity server. I stumpled upon this issue that was new with Sitecore 10. Thank you Derek for the detailed post that I used with Sitecore 9 that worked like a breeze.

Ref:

https://sitecore.derekc.net/setting-up-azure-active-directory-integration-with-sitecore-identity-server-sitecore-9-1/

Error

Could not create instance of type: My.Foundation.Custom.AzureAD.CustomExternalUserBuilder. No matching constructor was found. Constructor parameters:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace to help the bot

[ConfigurationException: Could not create instance of type: My.Foundation.Custom.AzureAD.CustomExternalUserBuilder. No matching constructor was found. Constructor parameters: ]

Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) +574

Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +163

Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72

Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +545

Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +326

Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72

Sitecore.Configuration.DefaultFactory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert) +842

Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +545

Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +326

Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, Boolean assert) +68

Solution

It took some time to figure out, but this simple attribute would solve the issue.

The solution for this is to add resolve=true tag in the patch config.

The config file as gist for reference.