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

Saving Items as byte array was a bad idea #8

Open
2 tasks
DiFFoZ opened this issue May 30, 2023 · 0 comments
Open
2 tasks

Saving Items as byte array was a bad idea #8

DiFFoZ opened this issue May 30, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@DiFFoZ
Copy link
Member

DiFFoZ commented May 30, 2023

Many users report that saving a INSERT query with an external program (e.g. HeidiSQL) can cause a broken Items byte array:

[04:00:52 ERR][Microsoft.EntityFrameworkCore.Query] An exception occurred while iterating over the results of a query for context type 'Kits.Databases.Mysql.KitsDbContext'.
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
  at System.IO.BinaryReader.ReadByte () [0x00018] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.IO.BinaryReader.Read7BitEncodedInt () [0x00019] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.IO.BinaryReader.ReadString () [0x0000f] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at Kits.API.KitItem.Deserialize (System.IO.BinaryReader br) [0x00000] in <b408e3839c8d44bc9b2d7caa48eb86b2>:0 
  at Kits.Extensions.ConvertorExtension.ConvertToKitItems (System.Byte[] block) [0x00034] in <b408e3839c8d44bc9b2d7caa48eb86b2>:0 
  at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,Microsoft.EntityFrameworkCore.Query.QueryContext,System.Data.Common.DbDataReader,Microsoft.EntityFrameworkCore.Query.Internal.ResultContext,int[],Microsoft.EntityFrameworkCore.Query.Internal.ResultCoordinator)
  at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1+AsyncEnumerator+<MoveNextAsync>d__17[T].MoveNext () [0x001ce] in <04749dad1c80429287c0de883da70092>:0

So, I'm thinking to rewrite it to use one of two options:

  • Saving Items as Json column (best for users experience)
  • Saving Items to another table with FK of Id
@DiFFoZ DiFFoZ added the enhancement New feature or request label May 30, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant