fparsec icon indicating copy to clipboard operation
fparsec copied to clipboard

Problem building on Linux

Open rmunn opened this issue 7 years ago • 2 comments

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.

rmunn avatar Dec 17 '17 16:12 rmunn

I had the same problem...

wallymathieu avatar Feb 08 '18 08:02 wallymathieu

Would really appreciate it if you would build and publish the .dlls for the dotnetcore2 version.

mattiasw2 avatar Mar 17 '18 09:03 mattiasw2