You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`mx diff`|**STRICT** — crashes |**STRICT** — crashes | Version control diff |
149
+
| Studio Pro `RevStatusCache`|**STRICT** — crashes |**STRICT** — crashes | Opening project with uncommitted changes |
150
+
151
+
**Key insight**: `mx check` passing does NOT mean Studio Pro can open the project. Always verify with `mx diff` when testing BSON writers.
152
+
153
+
**Why it matters**: Studio Pro calls `mx diff` internally during `RevStatusCache.DoRefresh()` to compare the working copy against git HEAD. Any BSON property mismatch → crash on open.
154
+
155
+
## Diagnostic: mx diff as Crash Reproducer
156
+
157
+
### Step 0: Reproduce Outside Studio Pro
158
+
159
+
```bash
160
+
# Self-diff: is the project's BSON clean?
161
+
mx diff project.mpr project.mpr output.mpr
162
+
# Success = all BSON matches schema. Crash = some mxunit has bad properties.
163
+
164
+
# Cross-diff: compare baseline vs modified
165
+
# 1. Extract baseline from git
166
+
mkdir /tmp/baseline &&cd project-dir && git archive HEAD -- *.mpr mprcontents/ | tar -x -C /tmp/baseline/
→ Compare the two lists. Properties in `baseNames` but not `newNames` = missing in our BSON. Properties in `newNames` but not `baseNames` = extra in our BSON.
→ No detail given. Use the property comparison tools below.
186
+
187
+
### Finding the Offending mxunit File
188
+
189
+
Write a Go tool (or use the pattern below) to compare property keys of mxcli-written files against Studio Pro-native files of the same `$Type`:
190
+
191
+
```go
192
+
// Walk mprcontents/, group files by $Type, compare key sets
193
+
// Files with EXTRA keys (vs native files of same type) = the crash cause
194
+
// Files with MISSING keys = also crash cause for mx diff
195
+
```
196
+
197
+
The principle: for each `$Type`, ALL instances must have the **exact same set of non-$ property names**. Any deviation → crash.
198
+
199
+
### Version-Specific Properties
200
+
201
+
Some properties only exist in certain Mendix versions. Before adding a property to a BSON writer:
202
+
1. Check `reference/mendixmodellib/reflection-data/` for the property definition
203
+
2. Check `min_version` if present
204
+
3. Test with `mx diff` self-diff on the target version
205
+
206
+
**Example**: `IsReusableComponent` exists in `Projects$ModuleImpl` in newer Mendix but NOT in 11.6.4. Writing it → crash.
207
+
138
208
## Common Error Patterns
139
209
210
+
### Studio Pro Crash: InvalidOperationException in MprObject..ctor (RevStatusCache)
211
+
212
+
**Symptom**: Studio Pro crashes on open with stack trace through `RevStatusCache.DoRefresh` → `CreateDeleteStatusItem` → `MprUnit.get_Contents` → `MprObject..ctor` → `b__2(JProperty p)`.
213
+
214
+
**Root cause**: `MprObject` constructor iterates each non-`$` BSON property and does a LINQ `First()` lookup against the Mendix type schema. Any property name not in the schema → `First()` fails → crash.
215
+
216
+
**This is triggered by**:
217
+
- Any uncommitted change to `.mpr` or `mprcontents/` files
218
+
- Studio Pro uses `mx diff` internally to diff working copy vs git HEAD
219
+
- Even `git update-index --assume-unchanged` does NOT help — Studio Pro reads files directly, bypassing git index
220
+
221
+
**Diagnosis**:
222
+
1. Run `mx diff baseline.mpr working.mpr output.mpr` to reproduce
223
+
2. If self-diff (`mx diff a.mpr a.mpr out.mpr`) crashes, the project itself has bad BSON
224
+
3. Use property comparison tool to find extra/missing keys
225
+
226
+
**Fix pattern**: Remove extra properties from writer, add missing properties with correct defaults (empty array `bson.A{int32(2)}` for lists, `nil` for nullable objects, `""` for strings).
227
+
140
228
### Studio Pro Crash: InvalidOperationException in MprProperty..ctor
141
229
142
230
**Symptom**: Studio Pro crashes when opening a project with `System.InvalidOperationException: Sequence contains no matching element` at `Mendix.Modeler.Storage.Mpr.MprProperty..ctor`.
0 commit comments