Configuration problems
Find and fix mistakes in your StellarAdmin configuration
When your configuration has a mistake, StellarAdmin attempts to gracefully recover from or work around the mistake. It reports a configuration problem that says what it changed and how to fix your configuration.
The following table shows some of the mistakes StellarAdmin can recover from:
| Mistake | What StellarAdmin does |
|---|---|
| A default sort on a column that isn't sortable | Sorts the grid in the data source's order. |
A PageSize that isn't one of the PageSizes | Adds the page size to PageSizes. |
AllowCreate() with a data source that can't create records | Leaves out the New button, and returns 404 for the create page. |
| A field whose property has no public setter | Leaves the field off the form. |
When StellarAdmin cannot recover from a configuration mistake, it makes the resource unavailable. For example, an EF Core resource is unavailable when no registered DbContext maps the entity. StellarAdmin hides an unavailable resource from the sidebar and the command palette, and returns 404 for its pages. In the Development environment, the 404 page says why the resource is unavailable. Your other resources, and the rest of your app, keep working.
Finding configuration problems
In the Development environment, when your configuration has problems, a floating notification is displayed at the bottom of every admin panel page. Click the notification to open a panel that lists the lines of your code that caused each problem, and how to fix it.




If a field, a column, a button or a sidebar item you configured is missing, check the configuration problems first.
StellarAdmin also logs each problem once, in every environment, in the StellarAdmin.Configuration category. The log entry names the file and line that configured the problem. Each kind of problem has its own event ID, so you can filter on them or alert on them.
The log level of a problem says how much of your configuration StellarAdmin could use:
| Log level | Used when | Example |
|---|---|---|
Error | StellarAdmin made the whole resource unavailable. | No registered DbContext maps the entity of an EF Core resource. |
Warning | StellarAdmin ignored something you configured. | The grid isn't sorted by the default sort, because its column isn't sortable. |
Information | StellarAdmin used what you configured, and adjusted something next to it. | The default PageSize is added to PageSizes, because it wasn't one of them. |
Most configuration problems are discovered at startup, but some can only be discovered when a page renders, such as a lookup's EnableCreate() for a resource without a create page.
Hiding the notification and failing on problems
To change how StellarAdmin reports problems, call ConfigureDiagnostics(). The example below hides the notification, and throws an exception at startup in the Testing environment:
builder.Services.AddStellarAdmin(admin =>
{
admin.ConfigureDiagnostics(diagnostics =>
{
diagnostics.ShowIndicator = false;
diagnostics.ThrowOnProblems = builder.Environment.IsEnvironment("Testing");
});
});You can set the following properties in the ConfigureDiagnostics() callback:
| Property | Description |
|---|---|
ShowIndicator | Whether the Development environment displays the notification. The default is true. StellarAdmin logs the problems either way. |
ThrowOnProblems | Whether StellarAdmin throws an InvalidOperationException that lists every problem when the app starts. The default is false. Problems found when a page renders are only logged. |
We suggest you set ThrowOnProblems in your tests or CI, so that a configuration mistake fails the build.