fparsec
fparsec copied to clipboard
Problem building on Linux
This issue probably isn't FParsec's fault per se, but it's something that FParsec will probably need to work around since I doubt the root cause of the issue will be fixed.
When building FParsec on Linux with Mono, I ran into several issues, one of which is the following exception thrown when running test_fparsec.exe
after the build has completed:
System.Runtime.Serialization.SerializationException: The type 'I18N.CJK.CP932Decoder' is not marked as serializable.
at FParsec.Cloning.Cloner.CreateWithoutLock (System.Type type) [0x0002e] in <e6b426514886430789b41741320a466a>:0
at FParsec.Cloning.Cloner.Create (System.Type type) [0x00010] in <e6b426514886430789b41741320a466a>:0
at FParsec.Test.CloningTests.encodingTests () [0x0007c] in <5a3691c4f61b05e0a7450383c491365a>:0
at FParsec.Test.CloningTests.run () [0x00037] in <5a3691c4f61b05e0a7450383c491365a>:0
at AllTests.run () [0x000bc] in <5a3691c4f61b05e0a7450383c491365a>:0
at <StartupCode$test_fparsec>.$AllTests.main@ () [0x00001] in <5a3691c4f61b05e0a7450383c491365a>:0
Looking at the Mono source, it seems that the error message is 100% correct: CP932Decoder
is not serializable. I haven't been able to find any documentation that specifies that decoder instances are supposed to be serializable, so I doubt the Mono project will consider it a bug that the CP932Decoder
class (and many other decoders) do not have the Serializable
attribute. Therefore, FParsec will probably need to work around this issue.
I worked around this by wrapping a try ... with :? System.Runtime.Serialization.SerializationException -> ()
expression around the tests in question (inside the for
loop). That worked for me. And I don't know if there's much value in testing old single-byte codepages whose Mono code hasn't been touched since 2006, so I think that the simplistic solution (just skip the test if a SerializationException
happens) is probably best here.
I had the same problem...
Would really appreciate it if you would build and publish the .dlls for the dotnetcore2 version.