private static async Task<Asset> CloneMetadataReferenceAssetAsync(Serializer serializer, AssetBuilder assetBuilder, Asset asset)
        {
            using (var stream = SerializableBytes.CreateWritableStream())
            using (var writer = new ObjectWriter(stream))
            {
                await asset.WriteObjectToAsync(writer, CancellationToken.None).ConfigureAwait(false);

                stream.Position = 0;
                using (var reader = new ObjectReader(stream))
                {
                    var recovered = serializer.Deserialize<MetadataReference>(asset.Kind, reader, CancellationToken.None);
                    var assetFromStorage = assetBuilder.Build(recovered, CancellationToken.None);

                    Assert.Equal(asset.Checksum, assetFromStorage.Checksum);

                    return assetFromStorage;
                }
            }
        }
        private static async Task VerifyOptionSetsAsync(Workspace workspace, string language)
        {
            var assetBuilder = new AssetBuilder(workspace.CurrentSolution);
            var serializer = new Serializer(workspace.Services);

            var asset = assetBuilder.Build(workspace.Options, language, CancellationToken.None);

            using (var stream = SerializableBytes.CreateWritableStream())
            using (var writer = new ObjectWriter(stream))
            {
                await asset.WriteObjectToAsync(writer, CancellationToken.None).ConfigureAwait(false);

                stream.Position = 0;
                using (var reader = new ObjectReader(stream))
                {
                    var recovered = serializer.Deserialize<OptionSet>(asset.Kind, reader, CancellationToken.None);
                    var assetFromStorage = assetBuilder.Build(recovered, language, CancellationToken.None);

                    Assert.Equal(asset.Checksum, assetFromStorage.Checksum);

                    // option should be exactly same
                    Assert.Equal(0, recovered.GetChangedOptions(workspace.Options).Count());
                }
            }
        }