Per Nergård (MVP)
OMVPSaaS CMS Developer CertificationCommerce Connect 13 Developer Certification +2
Sep 8, 2026
visibility 674
star star star star star
(0 votes)

Two more database surprises when upgrading from CMS 11 to CMS 13

Back in June I wrote about four database surprises when upgrading from CMS 11 to CMS 13 (old post). Here are two more, found on another CMS 11 upgrade. Both come from the same place — the site name — and both break the new Application Manager while the public site keeps working as if nothing were wrong.

The background for both: the CMS 13 upgrade copies your site name verbatim from tblSiteDefinition into the new tblApplication table, where it becomes the application's identifier — with rules CMS 11 never had.

Whitespace in the site name: Application Manager won't even load the site

If the name has a trailing space ("My Swedish Site " — easy to have sat unnoticed for years), every attempt to view the site in Application Manager fails with:

System.NullReferenceException
   at EPiServer.Cms.UI.Admin.ApplicationManager.Internal.CompositeApplicationRepository.ToModel(Application application)

The name is round-tripped as a URL route key, where the trailing space is lost. The repository lookup on the other side is an exact dictionary hit (StringComparer.OrdinalIgnoreCase — forgives casing, not whitespace), so it returns null, and ToModel dereferences it without a guard.

This one is sneaky twice over: the public site keeps working (content binds via GUIDs, host resolution is unaffected), and the stack trace ends in whatever middleware sits first in your pipeline — pointing you at your own code instead of the actual problem.

Fix: RTRIM the name columns and restart — the application dictionary is cached under ep:apps. SQL in the gist below.

Swedish characters in the site name: Application Manager loads — but nothing can be saved

With the whitespace gone, a name like "My Swedish Sité" loads and displays just fine. But try to save anything — a new hostname, for example — and you get a validation error saying the name isn't valid. Renaming the application in the UI doesn't help; the error keeps pointing at the old name.

The reason is in EPiServer.Applications.Application:

/// The name must start with a letter and can only contain
/// letters, digits, and underscores.
[Required]
[ResourceName]                          // ^[A-Za-z][_0-9A-Za-z]+\z — ASCII only
public string Name { get; private set; }

The name is validated on every save against ^[A-Za-z][_0-9A-Za-z]+\z — ASCII only. Any å, ä, ö or space fails it. And the kicker: Name has a private setter, so it cannot be changed through the admin UI or any public API. Save clones the stored application — old name and all — validates the whole entity, and fails on the stored name no matter what you type. A migrated site with a non-ASCII name is permanently unmanageable in Application Manager until the name is fixed directly in the database.

The working fix: set a new ASCII Name in tblApplication and keep the human-readable name in DisplayName, which only has a length limit and is what editors see. Nothing else is derived from the name — hosts, entry point and assets bind via keys and their own columns — so the rename is safe. Restart afterwards, same cache.

Both issues are reported to Optimizely: the missing null guard, the missing name validation/normalization at migration, and the absence of any rename path for names the migration itself created in an invalid state.

Wrapping up

Same lesson as last time, with two more entries for the pre-flight runbook: check your site names before the first CMS 13 boot — both for whitespace and against ^[A-Za-z][_0-9A-Za-z]+\z. Detection and fix SQL is in this gist — as always, read it, understand it, and run it at your own risk: [Gist]

Sep 08, 2026

Comments

error Please login to comment.
Latest blogs
Advanced Reviews 2.2.0

Editable review links without a CMS login and support for headless websites

Bartosz Sekula | Nov 22, 2026 |

No name

Jagmeet Kaur | Nov 19, 2026 |

What the CMS 13 MCP Server Actually Does When You Write Properties

This post covers the setup gotchas, what each

Adnan Zameer | Nov 19, 2026 |

Pick images from Optimizely DAM straight into rich text

Rich text editors in Optimizely CMS (SaaS), and in CMS 13.7.0 on sites that use the Content Manager, have a new image button. It puts images from t...

Stuart Greig | Nov 18, 2026

Setting up the TinyMCE image picker, and DAM images in Graph and the CMS REST API

The new TinyMCE image and video pickers put images and video from the CMS and from Optimizely DAM straight into rich text, in Optimizely CMS (SaaS)...

Stuart Greig | Nov 18, 2026

Add your own image source to the TinyMCE image picker

In CMS 13.7.0,  the TinyMCE image picker lets editors browse images from the CMS and from Optimizely DAM. Images from your own library can also be...

Stuart Greig | Nov 18, 2026