Skip to content

Commit fc535df

Browse files
committed
fix constructor order
this fixes the element getting owner set to null
1 parent c77de48 commit fc535df

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ICodec.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,11 @@ public static bool TryConstructCustomElement(Dictionary<string, Type> types, Dat
256256

257257
object uninitializedObject = RuntimeHelpers.GetUninitializedObject(derivedType);
258258

259-
elementConstructor.Invoke(uninitializedObject, [dataModel, elem_name, elem_id, elem_class]);
260-
261259
// this will initialize values such as
262260
// public Datamodel.ElementArray Children { get; } = [];
263261
customClassInitializer.Invoke(uninitializedObject, []);
264262

263+
elementConstructor.Invoke(uninitializedObject, [dataModel, elem_name, elem_id, elem_class]);
265264

266265
elem = (Element?)uninitializedObject;
267266
return true;

0 commit comments

Comments
 (0)