[Bug Report] TwinCollection.ClearMetadata does not clean metadata for properties #1971
Labels
bug
Something isn't working.
fix-checked-in
Fix checked into main or preview, but not yet released.
IoTSDK
Tracks all IoT SDK issues across the board
Context
Description of the issue
Using the GetTwin method from RegistryManager returns the TwinProperties as TwinCollection. If using ClearMetadata on the TwinCollection for e.g. the desired properties it will not clear the metadata for the properties. Because of that if accessing a property afterwards it will return a TwinCollection instead of a JObject in the TryGetMemberInternal method. This is unexpected because after clearing the metadata I would expect a JObject which causes a RuntimeBindingException.
Code sample exhibiting the issue
Current workaround which is really ugly is this:
The text was updated successfully, but these errors were encountered: