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

System.ArgumentOutOfRangeException when calling GetWithCas #211

Open
damiancosmoschapman opened this issue Feb 13, 2024 · 2 comments
Open
Assignees

Comments

@damiancosmoschapman
Copy link

We are getting a System.ArgumentOutOfRangeException when calling GetWithCas.

We are using

memcached service version - 1.6.18
EnyimMemcachedCore version - 2.6.6

We are getting the following exception when calling GetWithCas as follows:

GetWithCas<List<string>>(repository) // where repository is a string

System.ArgumentOutOfRangeException: Unexpected BsonType value: 0 (Parameter 'type')
   at Newtonsoft.Json.Bson.BsonDataReader.ReadType(BsonType type) in /_/Src/Newtonsoft.Json.Bson/BsonDataReader.cs:line 578
   at Newtonsoft.Json.Bson.BsonDataReader.ReadNormal() in /_/Src/Newtonsoft.Json.Bson/BsonDataReader.cs:line 376
   at Newtonsoft.Json.Bson.BsonDataReader.Read() in /_/Src/Newtonsoft.Json.Bson/BsonDataReader.cs:line 205
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateJObject(JsonReader reader)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at Enyim.Caching.Memcached.DefaultTranscoder.Deserialize[T](CacheItem item)
   at Enyim.Caching.MemcachedClient.PerformTryGet[T](String key, UInt64& cas, T& value)
   at Enyim.Caching.MemcachedClient.TryGetWithCas[T](String key, CasResult`1& value)
   at Enyim.Caching.MemcachedClient.GetWithCas[T](String key)

We have also tried using the MessagePackTranscoder, by adding it as part of the memcached settings, in appsettings.json but we are getting a similar exception error.

@cnblogs-dudu cnblogs-dudu self-assigned this Feb 14, 2024
@cnblogs-dudu
Copy link

This exception can not be reproduced with GetWithCas<T>. can you provide more details?

@damiancosmoschapman
Copy link
Author

Thank you for your prompt response.

I get this issue when I try to store the key "effe7a8c56f97d9f76e37bbdf5c49b8e9f17a4a6867e33e9db481faafa183abc" in a Cas
repository.

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

No branches or pull requests

2 participants