No constructor for type 'Umbraco.Cms.Core.PropertyEditors.PropertyEditorCollection' can be instantiated using services from the service container

2 min read 28-08-2024
No constructor for type 'Umbraco.Cms.Core.PropertyEditors.PropertyEditorCollection' can be instantiated using services from the service container


Troubleshooting "No constructor for type 'Umbraco.Cms.Core.PropertyEditors.PropertyEditorCollection' can be instantiated..." Error in Umbraco 13

Upgrading your Umbraco website from version 9 to 13 can sometimes throw unexpected errors. One common issue is the dreaded "No constructor for type 'Umbraco.Cms.Core.PropertyEditors.PropertyEditorCollection' can be instantiated using services from the service container" error message. This typically happens when attempting to publish content in the back office.

This error message implies that Umbraco's core functionality for managing property editors, which are crucial for defining content fields, is not properly initialized.

Let's delve into the root cause and explore effective solutions based on insights from the Stack Overflow community:

Understanding the Issue

As explained by user "Davo" on Stack Overflow, the issue arises from a potential incompatibility between the way Umbraco handles property editors in version 13 and the configuration setup in your Startup.cs.

Troubleshooting Steps

  1. Ensure Proper Service Registration:

    • The error often indicates a missing or misconfigured dependency within your ConfigureServices method.
    • You're already using the AddUmbraco extension method, which should handle most core services. However, you need to double-check that you're using the correct version and all necessary dependencies are registered.
  2. Check for Custom Property Editors:

    • If you have custom property editors, ensure they are compatible with Umbraco 13. This might involve updating their code or, in some cases, rewriting them to comply with the new architecture.
    • User "Davo" on Stack Overflow suggests that custom editors are a common source of the error.

Solutions

  1. Update Umbraco.Cms and Dependencies:

    • Begin by verifying that you're running the latest stable version of Umbraco.Cms and all associated packages.
    • Outdated packages could be causing the incompatibility.
  2. Review Custom Property Editors:

    • Carefully inspect your custom property editor code for compatibility with Umbraco 13.
    • Update or rewrite editors as needed to address potential breaking changes.
  3. Reset the Application:

    • Sometimes, a simple reset of your Umbraco application can resolve unexpected errors.
    • You can do this by deleting your App_Data folder and restarting the application.
  4. Seek Guidance:

    • If you're still unable to resolve the issue, consider seeking help from the Umbraco forum or Stack Overflow.
    • Providing detailed information about your setup, the specific error messages, and your custom property editors can significantly help the community assist you.

Additional Notes:

  • Remember to always back up your website before making significant changes.
  • Be mindful of version compatibility issues when upgrading packages.
  • Thoroughly test your website after making any changes to ensure functionality is preserved.

By understanding the underlying cause and following these steps, you'll be well on your way to resolving the "No constructor for type 'Umbraco.Cms.Core.PropertyEditors.PropertyEditorCollection'" error and getting your Umbraco website running smoothly on version 13.