| Description |
- Repro: A
static class whose static fields are DependencyProperty.Register(...) / RegisterAttached(...) initializers, where some method on that class is marked [RuntimeInitializeOnLoadMethod(...)] (any RuntimeInitializeLoadType).
- Result: Editor runs fine. The standalone Player exits silently ~1s after launch.
Player.log ends on the class's .cctor frame followed by a Noesis_UIPropertyMetadata_Create native access violation.
- Diagnosis: The
[RuntimeInitializeOnLoadMethod] hook forces the class's static constructor to run before the Noesis native runtime is initialized. All field initializers execute, including the Register(...)/RegisterAttached(...) calls, which P/Invoke into uninitialized native and AV. The Editor happens to have native up earlier, hiding it — an Editor-vs-Player asymmetry that only bites in builds.
- Why a bug, not a usage error: registering a
DependencyProperty is a normal operation; doing it "too early" silently crashing the Player (rather than throwing a catchable managed "Noesis not initialized yet" error) is a native-robustness defect. A guarded managed error would turn a build-only multi-hour investigation into a one-line fix. This is the "no native-absent guard" family applied to uninitialized (rather than stripped) native.
- Severity: High (build-only silent crash, no managed diagnostic).
- Unblocks dropping workaround: we lazy-wire such registrations behind a flag triggered from a Noesis-side event so the
.cctor can't run pre-init. A managed guard that throws a catchable error (or defers registration until native is up) removes the need for that dance.
|
|---|