Environment
| Component |
Version / Detail |
| Mendix Studio Pro |
11.8.0.0 |
| mxcli |
v0.2.0-dirty (built 2026-03-15T09:22:47Z) |
| OS |
macOS (Eto.Forms stack trace confirms Mac build) |
| Project |
Mendix app using git-backed .mpr + mprcontents/ layout |
| Trigger action |
F4 (Project → Synchronize from disk) |
Summary
After mxcli exec applies MDL changes to a project, Mendix Studio Pro 11.8.0.0 crashes with System.InvalidOperationException: Sequence contains no matching element whenever the user presses F4 to sync the project from disk.
The crash occurs in Studio Pro's version control status cache while it tries to parse the git-tracked (pre-mxcli) base version of .mxunit files that mxcli deleted. A JSON property in one of those files is not recognized by the Studio Pro 11.8.0.0 type schema, causing Enumerable.First(predicate) to throw because no element matches.
Reproduction Steps
- Run
./mxcli exec <script>.mdl -p "Project.mpr" to apply MDL changes.
- Commit all changes:
git add -A && git commit -m "chore: mxcli changes".
- Open the project in Studio Pro 11.8.0.0 (working tree is clean at this point).
- Make any structural change inside Studio Pro — e.g., delete a microflow.
- Press F4 (Synchronize from disk).
- Result: Studio Pro crashes with the exception below. The microflow disappears but an error dialog is shown. Studio Pro must be restarted.
- Expected: Studio Pro syncs cleanly and shows the updated model.
Minimal trigger: Deleting any document (microflow, page, etc.) in Studio Pro whose .mxunit file in git HEAD was written by mxcli, then pressing F4.
Full Stack Trace
System.InvalidOperationException: Sequence contains no matching element
at System.Linq.ThrowHelper.ThrowNoMatchException()
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
at Mendix.Modeler.Storage.Mpr.MprProperty..ctor(ICachedType containerType, JProperty property) in Mendix.Modeler.Storage/Mpr/MprProperty.cs:line 25
at Mendix.Modeler.Storage.Mpr.MprObject.<>c__DisplayClass5_0.<.ctor>b__2(JProperty p) in Mendix.Modeler.Storage/Mpr/MprObject.cs:line 34
at System.Linq.Enumerable.IEnumerableWhereSelectIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at Mendix.Modeler.Storage.Mpr.MprObject..ctor(JObject data) in Mendix.Modeler.Storage/Mpr/MprObject.cs:line 42
at Mendix.Modeler.Storage.Mpr.MprUnit.get_Contents() in Mendix.Modeler.Storage/Mpr/MprUnit.cs:line 70
at Mendix.Modeler.VersionControl.Status.RevStatusCache.ExtractUnitInfo(MprUnit mprUnit, Type& unitType, String& unitName, Guid& containerID)
at Mendix.Modeler.VersionControl.Status.RevStatusCache.CreateDeleteStatusItem(Guid unitID, String baseFilePath)
at Mendix.Modeler.VersionControl.Status.RevStatusCache.CreateStatusItem(DiffItem diff, Dictionary`2 unitDict, String baseFilePath, String mineFilePath)
at Mendix.Modeler.VersionControl.Status.RevStatusCache.AddStatusItems(IEnumerable`1 diffs, Dictionary`2 unitDict, String baseFilePath)
at Mendix.Modeler.VersionControl.Status.RevStatusCache.DoRefresh(IProgressInfo info)
at Mendix.Modeler.VersionControl.Status.StatusCacheManager.RefreshAll(IProgressInfo info)
at Mendix.Modeler.VersionControl.Status.StatusCacheManager.ProjectManagerOnProjectFileChanged(Object sender, ProjectFileChangedEventArgs e)
at Mendix.Modeler.Core.ProjectManager.RaiseProjectFileChanged(IProgressInfo info)
at Mendix.Modeler.Main.FileSystems.CoreFileSystemPlugin.Synchronize(IProject project, SynchronizeMode mode)
at Mendix.Modeler.Main.FileSystems.FileSystemPluginRegistry.<>c__DisplayClass11_0.<Synchronize>b__0(IFileSystemPlugin plugin)
at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate)
at Mendix.Modeler.Main.FileSystems.FileSystemPluginRegistry.Synchronize(IProject project, SynchronizeMode mode)
at Mendix.Modeler.Main.FileSystems.FileSystemPluginRegistry.ExecuteSynchronizeStepAction(Func`1 getProject, SynchronizeMode mode, IProgressInfo info)
at Mendix.Modeler.Main.FileSystems.FileSystemPluginRegistry.<>c__DisplayClass10_0.<AddSynchronizeStep>b__0(IProgressInfo info)
at Mendix.Modeler.Utility.Progress.StepBase`1.Run(TProgressInfo info) in Mendix.Modeler.Utility/Progress/Step.cs:line 32
at Mendix.Modeler.Utility.Progress.StepBase`1.Mendix.Modeler.Utility.Progress.IStep.Run(Object progressInfo) in Mendix.Modeler.Utility/Progress/Step.cs:line 37
at Mendix.Modeler.UIFramework.Progress.ProcessRunner.RunStep(IStep step) in Mendix.Modeler.UIFramework/Progress/ProcessRunner.cs:line 240
at Mendix.Modeler.UIFramework.Progress.ProcessRunner.OnDoWork(Object sender, DoWorkEventArgs e) in Mendix.Modeler.UIFramework/Progress/ProcessRunner.cs:line 157
at Mendix.Modeler.Undo.UndoDelegatingBackgroundWorker.OnDoWork(DoWorkEventArgs e) in Mendix.Modeler.Undo/UndoDelegatingBackgroundWorker.cs:line 22
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
--- End of stack trace from previous location ---
at Mendix.Modeler.UIFramework.Progress.ProcessRunner.Run() in Mendix.Modeler.UIFramework/Progress/ProcessRunner.cs:line 108
at Mendix.Modeler.Main.FileSystems.FileSystemPluginRegistry.LaunchSynchronizeProcess(IProject project)
at Mendix.Modeler.MainWindow.Menus.MenuItemsProviders.ProjectMenuDirectoryMenuItemsProvider.<>c__DisplayClass5_0.<.ctor>b__0()
at Eto.Forms.RelayCommand.<>c__DisplayClass0_0.<.ctor>b__0(Object obj)
at Eto.Forms.RelayCommand`1.Execute(Object parameter)
at Eto.PropertyStore.CommandWrapper.Command_Execute(Object sender, EventArgs e)
at Eto.Forms.Command.OnExecuted(EventArgs e)
at Mendix.Modeler.Controls.Menus.AsyncInvokedCommand.<>n__0(EventArgs e)
at Mendix.Modeler.Controls.Menus.AsyncInvokedCommand.<>c__DisplayClass2_0.<OnExecuted>b__0() in Mendix.Modeler.Controls/Menus/MenuItemViewModel.cs:line 192
at Mendix.StudioPro.MacOS.StudioProApplicationHandler.ActionWrapper.PerformAction()
Affected File (from git working tree)
This .mxunit file was deleted by Studio Pro when the user deleted a microflow. It was originally written to git HEAD by mxcli:
| File |
Notes |
mprcontents/a9/19/a919747b-fc45-4ff3-aec7-540195b228e0.mxunit |
Deleted by Studio Pro in-session; git HEAD version written by mxcli |
The crash happens when Studio Pro reads the git HEAD (base) version of this file to populate the VCS status panel — not the working-tree (deleted) version.
Root Cause Analysis
The call chain is:
RevStatusCache.CreateDeleteStatusItem
→ reads base (git HEAD) .mxunit file for the deleted document
→ MprUnit.get_Contents() deserializes it
→ MprObject..ctor iterates each JProperty in the JSON blob
→ MprProperty..ctor(ICachedType containerType, JProperty property)
calls containerType.Properties.First(p => p.Name == property.Name)
← THROWS: no property with that name exists in the schema
The problematic line is MprProperty.cs:25, which uses Enumerable.First() — a hard throw when no match is found. If an .mxunit file in git HEAD contains any property name not in Studio Pro's type registry, the F4 sync crashes.
Root cause: mxcli schema mismatch persists in git history
mxcli v0.2.0 writes .mxunit files using a model schema that differs from Mendix 11.8.0.0's expected schema. Once those files are committed, they remain in git HEAD. Any subsequent deletion of those files — whether by mxcli or by the user inside Studio Pro — will trigger this crash the next time Studio Pro refreshes its VCS status.
This means:
- Committing mxcli changes before opening Studio Pro does not prevent the crash.
- The crash is not limited to mxcli-deleted files in the working tree.
- Every user edit inside Studio Pro that touches an mxcli-authored
.mxunit file (delete, move, rename) is a potential trigger.
Secondary issue: Studio Pro defensive coding gap
Studio Pro's MprProperty..ctor uses .First() instead of .FirstOrDefault(). Even in a legitimate forward-compatibility scenario (unknown property from a newer schema), this causes a hard crash rather than graceful handling. This is a Studio Pro bug that amplifies the impact of the mxcli schema mismatch.
Workaround
Note: The original workaround (commit before opening Studio Pro) is insufficient. The crash occurs because git HEAD contains mxcli-written .mxunit files with unknown properties. Committing does not remove those files from git history — it just changes who holds the working-tree deletion. Any Studio Pro edit that deletes an mxcli-authored .mxunit file will still crash on F4.
Until fixed, the practical options are:
- Avoid VCS features in Studio Pro entirely while working on an mxcli-authored project. Do not press F4, do not open the VCS status panel, do not diff deleted documents.
- Do all structural edits in Studio Pro first (before any mxcli session), commit those from Studio Pro's own VCS tools, then switch to mxcli. Avoid interleaving Studio Pro structural edits with mxcli sessions on the same files.
- Use mxcli exclusively for all model changes and never delete/rename documents in Studio Pro after an mxcli session has touched those files.
Recommended Fixes
For the mxcli developer
-
Audit the schema version used when writing .mxunit files. Confirm that all properties serialised into mprcontents/*.mxunit files match the property names in the target Mendix version's type registry (Mendix 11.8.0.0 in this case).
-
Consider writing a .mxunit schema compatibility test: after exec, read back each written .mxunit file and verify all JSON keys are in the expected schema. This would catch this class of bug before the user hits F4.
-
Document the known limitation: if mxcli intentionally uses a different schema (e.g., it targets a newer or older Mendix model version), the README or release notes should warn users that F4 sync in Studio Pro will crash until changes are committed/stashed.
For the Mendix Studio Pro team (secondary)
In MprProperty.cs:25, replace:
// Current (crashes on unknown property):
var typedProp = containerType.Properties.First(p => p.Name == property.Name);
with:
// Suggested (graceful handling):
var typedProp = containerType.Properties.FirstOrDefault(p => p.Name == property.Name);
if (typedProp == null)
{
// Log warning and skip unknown property — don't crash VCS status refresh
Logger.Warn($"Unknown property '{property.Name}' on type '{containerType.Name}' — skipping.");
return;
}
This would make Studio Pro resilient to schema mismatches from external tools (mxcli, migration scripts, etc.) and prevent a full crash on F4.
Additional Context
- All mxcli changes were committed before Studio Pro was opened. The crash was triggered by a Studio Pro-initiated deletion (user deleting a microflow in Studio Pro), not by mxcli-deleted files in the working tree.
- The crash is reproducible whenever: (a) git HEAD contains
.mxunit files written by mxcli, and (b) the user deletes any such document inside Studio Pro and then presses F4.
- The scope is broader than originally assessed: it applies to any
.mxunit file authored by mxcli and present in git HEAD, not just folder container units (Projects$Folder). Microflow units, page units, and others are all candidates.
Environment
.mpr+mprcontents/layoutSummary
After
mxcli execapplies MDL changes to a project, Mendix Studio Pro 11.8.0.0 crashes withSystem.InvalidOperationException: Sequence contains no matching elementwhenever the user presses F4 to sync the project from disk.The crash occurs in Studio Pro's version control status cache while it tries to parse the git-tracked (pre-mxcli) base version of
.mxunitfiles that mxcli deleted. A JSON property in one of those files is not recognized by the Studio Pro 11.8.0.0 type schema, causingEnumerable.First(predicate)to throw because no element matches.Reproduction Steps
./mxcli exec <script>.mdl -p "Project.mpr"to apply MDL changes.git add -A && git commit -m "chore: mxcli changes".Minimal trigger: Deleting any document (microflow, page, etc.) in Studio Pro whose
.mxunitfile in git HEAD was written by mxcli, then pressing F4.Full Stack Trace
Affected File (from git working tree)
This
.mxunitfile was deleted by Studio Pro when the user deleted a microflow. It was originally written to git HEAD by mxcli:mprcontents/a9/19/a919747b-fc45-4ff3-aec7-540195b228e0.mxunitThe crash happens when Studio Pro reads the git HEAD (base) version of this file to populate the VCS status panel — not the working-tree (deleted) version.
Root Cause Analysis
The call chain is:
The problematic line is
MprProperty.cs:25, which usesEnumerable.First()— a hard throw when no match is found. If an.mxunitfile in git HEAD contains any property name not in Studio Pro's type registry, the F4 sync crashes.Root cause: mxcli schema mismatch persists in git history
mxcli v0.2.0 writes
.mxunitfiles using a model schema that differs from Mendix 11.8.0.0's expected schema. Once those files are committed, they remain in git HEAD. Any subsequent deletion of those files — whether by mxcli or by the user inside Studio Pro — will trigger this crash the next time Studio Pro refreshes its VCS status.This means:
.mxunitfile (delete, move, rename) is a potential trigger.Secondary issue: Studio Pro defensive coding gap
Studio Pro's
MprProperty..ctoruses.First()instead of.FirstOrDefault(). Even in a legitimate forward-compatibility scenario (unknown property from a newer schema), this causes a hard crash rather than graceful handling. This is a Studio Pro bug that amplifies the impact of the mxcli schema mismatch.Workaround
Until fixed, the practical options are:
Recommended Fixes
For the mxcli developer
Audit the schema version used when writing
.mxunitfiles. Confirm that all properties serialised intomprcontents/*.mxunitfiles match the property names in the target Mendix version's type registry (Mendix 11.8.0.0 in this case).Consider writing a
.mxunitschema compatibility test: after exec, read back each written.mxunitfile and verify all JSON keys are in the expected schema. This would catch this class of bug before the user hits F4.Document the known limitation: if mxcli intentionally uses a different schema (e.g., it targets a newer or older Mendix model version), the README or release notes should warn users that F4 sync in Studio Pro will crash until changes are committed/stashed.
For the Mendix Studio Pro team (secondary)
In
MprProperty.cs:25, replace:with:
This would make Studio Pro resilient to schema mismatches from external tools (mxcli, migration scripts, etc.) and prevent a full crash on F4.
Additional Context
.mxunitfiles written by mxcli, and (b) the user deletes any such document inside Studio Pro and then presses F4..mxunitfile authored by mxcli and present in git HEAD, not just folder container units (Projects$Folder). Microflow units, page units, and others are all candidates.