The extension method ConcurrentBagExtensions.Clear() does not work, so you end up with a lot of duplicates if the discovery of supported attributes is done several times.
Instead of a ConcurrentBag we should use a simple HashSet for _supportedAttributes to make sure there is no duplicates, and we should lock the end part of DiscoverAttributes where the actual change to the hashset is done:
The extension method ConcurrentBagExtensions.Clear() does not work, so you end up with a lot of duplicates if the discovery of supported attributes is done several times. Instead of a ConcurrentBag we should use a simple HashSet for _supportedAttributes to make sure there is no duplicates, and we should lock the end part of DiscoverAttributes where the actual change to the hashset is done:
same thing for _supportedCommandsReceived and _supportedCommandsGenerated