fix: throw if id null

review comment
This commit is contained in:
Björn
2025-06-26 17:18:04 +02:00
parent 6e6e737807
commit 2e2c8e1732
2 changed files with 7 additions and 3 deletions
@@ -199,7 +199,7 @@ public class CreateCollection : VariableParameterComponentBase
if (instanceGoo.CastFrom(obj))
{
instanceGoo.Value.Path = childPath;
wrapperGoo.Value.Parent = parentCollection;
instanceGoo.Value.Parent = parentCollection;
parentCollection.Elements.Add(instanceGoo.Value);
}
else
@@ -59,10 +59,14 @@ public class SpeckleBlockInstanceWrapper : SpeckleObjectWrapper
set
{
_definition = value;
if (_definition != null)
{
_definition.ApplicationId ??= Guid.NewGuid().ToString();
_instanceProxy.definitionId = _definition.ApplicationId;
_instanceProxy.definitionId =
_definition.ApplicationId
?? throw new InvalidOperationException(
"Block definition must have ApplicationId before being assigned to instance"
);
}
}
}