YSOD when Umbraco package manifest doesn't validate

October 24, 2014

This is an old archived post, content maybe out of date, links may be broken and layout may be broken.

I’ve put together an Umbraco application startup handler over on github that makes Umbraco throw an exception if any package manifest files aren’t valid JSON or reference non existent files.

Why?

Building custom property editors using JavaScript and HTML allows developers without .NET specifc tooling or knowledge to start customising Umbraco (which is great).

But the flipside of this - is that it can be little daunting for .NET developers who are learning Javascript and Angular to also pick up some of the tooling and debugging techinques at the same time.

At the time of writing JSON validation isn’t part of Visual Studio without the web essentials plugin and even if you have this you still need to associate the .manifest file extension to get JSON validation working.

From teaching the Umbraco course we learned that when a property editor doesn’t work there are a few common causes and frustratingly each is diagnosed by the developer in a different way:

  • Invalid package manifest - Check the Umbraco Logs
  • Missing CSS or Javascript - Back office displays a 404
  • Invalid Javascript - Check your browser console
  • Cached Javascript - Empty browser cache and reload

There are a couple of other common issues also.

The idea of this plugin is to put a hard stop in place when there is a fundamental problem with the property editor (or dashboard). I think that when a developer is learning how to extend Umbraco for the first time, getting hung up on mis-spellings, missing quotes and semi-colons can be quite dis-heartening, especially if it takes you several minutes to find.

This plugin should hopefully stop .NET developers spending a frustrating amount of time on debugging syntax errors and allow them to have fun getting creative while learning angular and Umbraco property editors.

Contribute

There are a couple more things that the plugin could do:

  • Validate the manifest against a schema
  • Validate any referenced CSS and JavaScript files

I’ve tried to implement the first of these and commented the code out as it didn’t seen to work very well.

If you have an interest in adding these, then feel free to do so - the project is on github and I’ll happily add you as a contributor.

Internal stuff in the core

Lots of this functionality is contained in the core of Umbraco, but marked as internal. So unfortunately - there is quite a lot of duplication in code here.

Rather than have this as an extension to Umbraco - I’d like to see a configuration setting that allows you to tell Umbraco to throw an exception when there is an issue with a property editor or dashboard.

Leave a Comment

Comments are manually moderated and added once reviewed.

© 2021 Darren Ferguson, Built with Gatsby.