Per Nergård (MVP)
OMVPSaaS CMS Developer CertificationCommerce Connect 13 Developer Certification +2
Sep 8, 2026
visibility 477
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
Building UI Extensions for Optimizely SaaS CMS

Introduction Developers have been extending the functionality of Optimizely PaaS CMS for years using addons built in C# and deployed as NuGet...

Mark Stott | Oct 15, 2026

Cheapskate AI Translator: Because Translation Should Not Require a Second Mortgage

There is a particular kind of software project that begins with a detailed architecture document, a product roadmap, and a carefully assembled...

Linh Doan Cuu | Oct 15, 2026

Computed Fields in CMS 13 Content Contracts with Optimizely Graph

Content Contracts in Optimizely CMS 13 allow different content types to share a common structure when querying Optimizely Graph. But what if the...

Mardy | Oct 14, 2026

Opal Workflow Agents And The Graph Webhook Trap

What we did? We built a compliance review workflow agent in Opal. The job was simple: when an editor submits a page for review in Optimizely CMS 13...

Ritu Madan | Oct 14, 2026