Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueTuple is not supported as dictionary key when using AllPropertiesExtractor #17

Open
AndrewKostousov opened this issue Apr 15, 2019 · 0 comments

Comments

@AndrewKostousov
Copy link
Contributor

The following code:

var serializer = new Serializer(new AllPropertiesExtractor());
var dict = new Dictionary<(string, string), string>
    {
        {("k11", "k12"), "v1"},
        {("k21", "k22"), "v2"}
    };
var bytes = serializer.Serialize(dict);
serializer.Deserialize<Dictionary<(string, string), string>>(bytes);

fails with:

System.ArgumentException : An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Read_Dictionary`2_7baa8df0-d792-4e03-bc5a-1291b06478b5(IntPtr , Int32& , Dictionary`2& , ReaderContext )
   at 7884d4f6-1cd8-4766-9648-ca5616cb25c2(IntPtr , Int32& , Dictionary`2& , ReaderContext )
   at GroBuf.GroBufReader.Read[T](IntPtr data, Int32& index, Int32 length, T& result) in C:\projects\open-source\skbkontur\GroBuf\GroBuf\GroBufReader.cs:line 98
   at GroBuf.GroBufReader.Read[T](Byte[] data, T& result) in C:\projects\open-source\skbkontur\GroBuf\GroBuf\GroBufReader.cs:line 45
   at GroBuf.GroBufReader.Read[T](Byte[] data) in C:\projects\open-source\skbkontur\GroBuf\GroBuf\GroBufReader.cs:line 75
   at GroBuf.Serializer.Deserialize[T](Byte[] data) in C:\projects\open-source\skbkontur\GroBuf\GroBuf\Serializer.cs:line 50

serializer = new Serializer(new AllFieldsExtractor()) works as expected though.

AndrewKostousov added a commit that referenced this issue Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant