-
Notifications
You must be signed in to change notification settings - Fork 75
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
Migration from lz4net to K4os causes System.AccessViolationException #36
Comments
Stack trace does not indicate anything in LZ4, but I can take a look, if you attach some working reporduction. |
Hi, please find attached a working reproduction. In my case it throws an error when I create 5000 objects but if I use a lower number it will work fine. I am targeting .NET Framework 4.7.1
|
You can raise an issue of https://docs.microsoft.com/en-us/dotnet/api/system.io.stream.read?view=netcore-3.1 Note: "Returns: The total number of bytes read into the buffer. This can be less than the number of bytes allocated in the buffer if that many bytes are not currently available, or zero (0) if the end of the stream has been reached." There is a lot of libraries which do not handle this case correctly. In the meantime you can use |
Understood, thanks! |
Hi,
I have tried migrating my code from lz4net to K4os.Compression.LZ4 and unfortunatelly manage to run into some errors when using Apex serializer and LZ4 stream from FileStream.
This is how I used the lz4net streams to save a file:
New code (compression works fine, it gives slightly smaller file sizes but I have verified these and the bytes written to file are correct):
Now for reading the file back I used to use:
Which with the new library becomes this:
Unfortunately it gives me an error which is due to the LZ4DecoderStream returning a stream that's not long enough compared to the original data.
I can fix this by copying the LZ4DecoderStream to a MemoryStream and use that when deserialising:
However this only works up to a certain file size which is not big enough for my case. Is there something I am doing wrong here or is there a bug or a compatibility issue with the Apex serialization?
`
The text was updated successfully, but these errors were encountered: