SCMU fails to start when there is an instance with corrupt XML configuration files. - #5684
Draft
soujay wants to merge 15 commits into
Draft
SCMU fails to start when there is an instance with corrupt XML configuration files.#5684soujay wants to merge 15 commits into
soujay wants to merge 15 commits into
Conversation
added 10 commits
August 4, 2026 14:31
Instance constructors never throw for config errors - they load the instance in the error state. The try/catch around construction (with ad-hoc %TEMP% logging) hid exactly the symptom the bug is about: an instance disappearing from the list.
…her types MonitoringInstance takes the IWindowsServiceController seam and creates its AppConfig inside the same try/catch as ServiceControl/Audit instances, making the corrupt-config path testable and identical across all three types.
ConfigurationLoadError now includes the config file path in all three instance types and on refresh failure. Reload() rethrows the original load exception instead of wrapping the path a second time. Removes the unused InstanceDetailsViewModel.ConfigurationLoadError/ConfigurationFilePath pass-throughs.
UpdateServiceInstance previously ignored a same-name/different-type update silently, leaving the view model bound to stale state. It now throws, matching the existing name guard.
…urce seam ListInstancesViewModel gets an internal constructor overload taking a getAllInstances function (public constructor defaults to InstanceFinder.AllInstances), so the summary banner logic is specified without enumerating real Windows services. Removes the unused InstancesWithConfigErrors property.
…e list Wires the previously dead HasConfigurationErrors/ConfigurationErrorMessage bindings into ListInstancesView, styled like the per-instance banner.
Adds the two examples the retrofit missed: corruption appearing after load (PostRefreshInstances -> UpdateServiceProperties catch) and recovery driven through the DEPLOYED INSTANCES refresh flow instead of updating a single view model directly.
Seven scenarios targeting real-machine behavior: SCMU startup with a corrupt config (the original crash), InstanceFinder enumeration against real Windows services, and the XAML banner wiring - the two spots the mutation pass confirmed the automated suite cannot protect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an instance's config file contains invalid XML, SCMU now captures the parsing error and displays the affected instance in the UI with a clear error message and banner. The refresh functionality has also been fixed to properly reload instances and update their configuration error state.
Feature: SCMU resilience to corrupt instance configuration files
As an operator managing instances through ServiceControl Management Utility (SCMU),
I want SCMU to start and show every installed instance even when one of them has a
corrupt configuration file, so that I can see which instance is broken and fix it
instead of being locked out of the tool entirely.
Vocabulary
ServiceControl.Config), the Windowsdesktop tool used to install and manage instances.
error instance ("ServiceControl"), audit instance ("ServiceControl Audit"),
and monitoring instance ("ServiceControl Monitoring").
<exe name>.exe.configin its install path(e.g.
ServiceControl.exe.config), read by SCMU to display and edit settings.invalid XML; loading it throws instead of returning settings.
listed, but flagged with a
CONFIGURATION ERRORstatus, its settings unavailableand config-dependent actions blocked.
banner = the banner above the instance list naming all corrupt instances.
configuration from disk and updates each instance card in place.
Rules and Examples
Rule 1: Must load every installed instance even when its configuration file is corrupt
Enumeration must never let one broken instance take down the whole list. A corrupt
instance still appears, carrying a configuration error instead of its settings; its
display name falls back to the Windows service name (the config it would normally
be read from is unreadable).
instance still loads, flagged with a configuration error.
instance still loads, flagged with a configuration error.
instance still loads, flagged with a configuration error.
error is flagged.
Rule 2: Must show the configuration error in place of the service status
The affected instance must be visibly broken in the UI: the status line reads
CONFIGURATION ERRORinstead of the Windows service status, neither the running northe stopped indicator is shown, and the error banner explains what failed and names
the file the operator has to fix.
running nor the stopped indicator is shown.
to load and names the config file.
service status is shown as usual.
Rule 3: Must block actions that require a valid configuration while the error persists
Starting, stopping, editing, or viewing advanced options of an instance whose
configuration cannot be read would operate on unknown state. Everything derived from
configuration (transport, persister) is also unavailable.
be edited and started as usual.
Rule 4: Should recover the instance once the configuration file is fixed and the list is refreshed
The operator's fix loop is: see the error → repair the file on disk → refresh SCMU.
Refresh must re-read the configuration from disk and clear the error state without
restarting SCMU. Refresh updates each instance in place — it never swaps state
between instances.
instance returns to normal (service status shown, edit allowed).
next refresh flags the error.
refresh flow (the same path the UI triggers), not just by updating a single
instance directly.
differently-named instance and is rejected.
of a different type (same name) and is rejected.
Rule 5: Must summarize configuration errors above the instance list
The per-instance banner can be far below the fold in a long list. A summary banner at
the top of the DEPLOYED INSTANCES screen names the corrupt instance(s) so the operator
sees at a glance that something needs fixing, and disappears when everything is
healthy.
of them.
shown.
Resolved decisions (for implementation)
InstanceDetailsViewModelobserved over realServiceControlInstance/ServiceControlAuditInstanceobjects loaded from real(corrupt or valid) config files in a temp folder, with the Windows service
substituted through the existing
IWindowsServiceControllerseam. A full SCMUend-to-end test (real Windows services) is not automatable in this repository's
test suites.
ServiceControl/TransportType = LearningTransportfully loads throughReload(), so counter-examples exercise the genuine success path.AppConfigWrappercaptures the open failure;instance constructors catch any
Reload()failure, setConfigurationLoadError, fall back to the service name, and record the error onthe
ReportCard. Both paths are covered by Rule 1 regardless of whetherConfigurationManagerthrows eagerly (at open) or lazily (at first read).MonitoringInstancetakes theIWindowsServiceControllerseam like the other twoand creates its
AppConfiginside the same try/catch, so a corrupt monitoringconfig is caught and testable identically.
InstanceFinderdoes not wrapinstance construction in a try/catch that omits failing instances (and does not
write ad-hoc logs to
%TEMP%). The constructors themselves never throw for configerrors — they load the instance in the error state instead. An instance that fails
to load must be visible, not missing.
ConfigurationLoadErroris formatted asFailed to load configuration file '<path>': <reason>, so both banners tell theoperator exactly which file to fix.
ListInstancesViewbinds a summary banner toListInstancesViewModel.HasConfigurationErrors/ConfigurationErrorMessage.The view model takes a
getAllInstancesseam (internal constructor overload,defaulting to
InstanceFinder.AllInstances) so the banner logic is testablewithout enumerating real Windows services.
UpdateServiceInstancerejects an update whose name or type differs from the instance the view model
wraps, instead of silently ignoring it.