xorxornop / LZ4PCL

Streaming safe+unsafe x86/64 LZ4 compression portable class library in C#
Apache License 2.0
16 stars 3 forks source link

Does your repository actually support Xamarin? #1

Open callanh opened 8 years ago

callanh commented 8 years ago

Apologies for creating an issue on your repository but I couldn't find another way to contact you.

I am having problems with LZ4.NET as it doesn't seem to work on Xamarin. I've asked MiloszKrajewski and discovered that he has not actually tested on Xamarin!

EDIT: I have tested LZ4PCL on Xamarin.iOS and Xamarin.Android and it works! Thank you, I will relate this back to MiloszKrajewski.

It would be helpful if the nuget package for LZ4PCL had signing using a .snk file. Is this something you are happy to do?

xorxornop commented 8 years ago

Ah, I've not looked at this code in a long time, been far too busy. Judging from your error message, it looks like the code is using the 'unsafe' codec (which is a lot faster). I don't know if this works in Xamarin, I only ever tested the unsafe variant on x64, whereas most Xamarin devices will be running on ARM. Some #if preprocessor code might be needed to disable the unsafe version on Xamarin. On 12 May 2016 12:53 p.m., "callanh" notifications@github.com wrote:

Apologies for creating an issue on your repository but I couldn't find another way to contact you.

I am having problems with LZ4.NET as it doesn't seem to work on Xamarin. I've asked MiloszKrajewski and discovered that he has not actually tested on Xamarin!

On Xamarin.Android I get this error:

System.InvalidProgramException: Invalid IL code in LZ4pn.LZ4Codec:Encode32 (byte,byte,int,int): IL_003c: stloc.3

On Xamarin.iOS I get this error:

System.ExecutionEngineException: Attempting to JIT compile method 'LZ4pn.LZ4Codec:Encode32 (byte,byte,int,int)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

can be reproduced using this code:

var MemoryStream = new MemoryStream(); var CompressStream = new LZ4.LZ4Stream(MemoryStream, LZ4.LZ4StreamMode.Compress); CompressStream.Write(new byte[1] { 0xFF }, 0, 1);

CompressStream.Flush();

The exception occurs on the call to Flush. Any advice or suggestions would be appreciated!

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/zenith-nz/LZ4PCL/issues/1

xorxornop commented 8 years ago

Ah. Didn't see your edit, i'm glad it works now. Re: signing, normally, yes, but I am extremely busy at the moment. If it can wait a while, then yes I can do that, but in the near term probably not. It also has the issue of signing's 'viral' nature in that it makes the package harder to use for non-signed-package users, necessitating a separate package, unless I'm mistaken and this doesn't happen anymore...

callanh commented 8 years ago

Hey thanks for the response! It works great and I have just signed the library myself. So it isn't urgent, the only problem is I can't use your nuget package.

The viral nature of signing only works in the other direction. If my library needs to be signed, then everything it references needs to be signed. Which is why I need LZ4PCL signed in the first place!

It is trivial to do when you get some time. You run this command from the VS Command Prompt:

sn -k LZ4PCL.snk

Add the file to your project and turn on signing in the project properties.

You have my appreciation for publishing this project - it really saved me a lot of time and aggravation. Thanks heaps!