Skip to content
New issue

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

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

Already on GitHub? # to your account

ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: capacity #350

Open
79loli opened this issue Nov 14, 2024 · 3 comments

Comments

@79loli
Copy link

79loli commented Nov 14, 2024

ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: capacity
System.Collections.Generic.HashSet1[T]..ctor (System.Int32 capacity, System.Collections.Generic.IEqualityComparer1[T] comparer) (at <378523c1e6ba4db992c5a1e98a5541ae>:0)
MemoryPack.Formatters.HashSetFormatter1[T].Deserialize (MemoryPack.MemoryPackReader& reader, System.Collections.Generic.HashSet1[T]& value) (at Assets/Plugins/MemoryPack/Runtime/MemoryPack.Core/Formatters/CollectionFormatters.cs:411)
UserInfoSave.Deserialize (MemoryPack.MemoryPackReader& reader, UserInfoSave& value) (at MemoryPack.Generator.Roslyn3/MemoryPack.Generator.MemoryPackGenerator/UserInfoSave.MemoryPackFormatter.g.cs:215)
UserInfoSave+UserInfoSaveFormatter.Deserialize (MemoryPack.MemoryPackReader& reader, UserInfoSave& value) (at MemoryPack.Generator.Roslyn3/MemoryPack.Generator.MemoryPackGenerator/UserInfoSave.MemoryPackFormatter.g.cs:280)
MemoryPack.MemoryPackSerializer.Deserialize[T] (System.Buffers.ReadOnlySequence`1[System.Byte]& buffer, T& value, MemoryPack.MemoryPackSerializerOptions options) (at Assets/Plugins/MemoryPack/Runtime/MemoryPack.Core/MemoryPackSerializer.Deserialize.cs:81)

@79loli
Copy link
Author

79loli commented Dec 1, 2024

Because the structure is immutable, I changed it. This prompt is too difficult to understand

@neuecc
Copy link
Member

neuecc commented Dec 2, 2024

Could you provide me with a simple reproduction code?
Since ArgumentOutOfRangeException is a system exception message, we need to throw an exception that correctly traps the situation, so as pointed out, there is room for improvement.

@79loli
Copy link
Author

79loli commented Dec 11, 2024

Simply adding fields to the structure can cause this error

Changing the structure name will not result in errors

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants