Exception with mono



I got these exception running my application on mono (on Framework .Net it works fine)
Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for LZ4.LZ4Codec ---> System.NotSupportedException: No LZ4 compression service found
at LZ4.LZ4Codec..cctor () [0x00000] in <filename unknown>:0

Do you have any idea ?


Krashan wrote Mar 24, 2015 at 1:12 PM

I believe I have. On startup it tries to find out which encoder/decoder can be used mixed mode/unsafe/safe. Testing availability of mixed mode involves reading registry key (to find VC++2010 Runtime).
I understand you don't have registry access on mono.

I will wrap testing from registry in try ... except, but for now you can take LZ4n or LZ4s assembly instead of "all-on-one".

facotl wrote Mar 24, 2015 at 4:31 PM


Thank you for your response.
Actually I use nuget to import LZ4 in my project. Is there any way to force LZ4n or LZ4s with it ?

facotl wrote Mar 24, 2015 at 4:35 PM

At the end, my application will run on ARM target. Does LZ4n or LZ4s call x86 native code or it's clearly portable ?

Krashan wrote Apr 1, 2015 at 11:07 AM

Mono: I will make registry check safer so it will work on Mono without problems
ARM: It depends, that mey or mey not be a problem. LZ4 is algorithm tailored for little-endian architecture. From what I heard (don't quote me on that though) ARM is big-endian but blocks of code may be ran as little endian. But the safe answer is: I DON'T KNOW.

Krashan wrote Jul 29, 2015 at 9:06 PM

Addressed in (see: https://github.com/MiloszKrajewski/lz4net)