This method or property must be called within the lambda passed to QueuedTask.Run.
Remarks
Layer metadata is typically editable unless the Layer is using an underlying
data source for metadata or the .aprx is not editable. Sub layer types do not
support metadata. They typically have a single source, specified on the parent
layer, that controls the metadata.
Requirements
Target Platforms: Windows 11, Windows 10, Windows 8.1