mbraceproject / FsPickler

A fast multi-format message serializer for .NET
http://mbraceproject.github.io/FsPickler/
MIT License
323 stars 54 forks source link

Use FSharp.Compiler.Tools instead of the system compiler #95

Closed 0x53A closed 6 years ago

0x53A commented 6 years ago

Trying to build on windows fails in VS, Rider and fake:

image

I assume that is because this change by don is not yet included in these two IDEs (and fake uses the VS compiler): https://github.com/Microsoft/visualfsharp/pull/3283

Even unrelated to this timing issue, I am a big fan of not relying on system state.

What do you think?

It would be possible to do the same for the C# compiler with "Microsoft.Net.Compilers", so you could use C#7 features, and even people with only VS2013 could still compile the projects.

eiriktsarpalis commented 6 years ago

I imagine that this only works for FAKE builds. I see that the appveyor build is failing, presumably because it doesn't use FAKE. We would want something that works with both.

0x53A commented 6 years ago

It is only indirectly related to FAKE.

The issue is that it needs a "paket restore" before the build:

https://github.com/0x53A/FsPickler/blob/c0a47e6420b15dde983eafce70152799fe22368e/src/FsPickler.Json/FsPickler.Json.fsproj#L3

It imports a file from the packages dir, which obviously doesn't work if the packages were not restored yet.

It is possible to do the same for apveyor by adding "paket restore" to the install group in apyeavor.yml: https://www.appveyor.com/docs/build-configuration/#installing-additional-software

eiriktsarpalis commented 6 years ago

thanks

0x53A commented 6 years ago

One other thing I noticed - it is probably not relevant, but wanted to ask anyway:

On my local build and on appveyor, but not on travis, there is a warning in the output during one test:

***** MBrace.FsPickler.Tests.InMemory Tests("FsPickler.Binary").FsPickler Serializer Tests.8. Stress test: massively auto-generated objects
Serializing 'System.NotFiniteNumberException' failed with error: MBrace.FsPickler.FsPicklerException: Error serializing object of type 'System.Object'. ---> System.InvalidCastException: Specified cast is not valid.
   at MBrace.FsPickler.Pickler`1.UntypedWrite(WriteState state, String tag, Object value) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\Pickler\Pickler.fs:line 66
   at <StartupCode$FsPickler>.$ISerializablePickler.writer@145-39.Invoke(WriteState w, String _arg1, T t) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\PicklerGeneration\ISerializablePickler.fs:line 149
   at MBrace.FsPickler.CompositePickler`1.Write(WriteState state, String tag, T value) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\Pickler\CompositePickler.fs:line 218
   at MBrace.FsPickler.CompositePickler`1.Write(WriteState state, String tag, T value) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\Pickler\CompositePickler.fs:line 196
   at MBrace.FsPickler.RootSerialization.writeRootObject[T](IPicklerResolver resolver, ReflectionCache reflectionCache, IPickleFormatWriter formatter, FSharpOption`1 streamingContext, FSharpOption`1 sifter, Boolean isHash, Boolean disableSubtypes, Pickler`1 pickler, T value) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\FsPickler\RootSerialization.fs:line 46
   --- End of inner exception stack trace ---
   at MBrace.FsPickler.RootSerialization.writeRootObject[T](IPicklerResolver resolver, ReflectionCache reflectionCache, IPickleFormatWriter formatter, FSharpOption`1 streamingContext, FSharpOption`1 sifter, Boolean isHash, Boolean disableSubtypes, Pickler`1 pickler, T value) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\FsPickler\RootSerialization.fs:line 50
   at MBrace.FsPickler.FsPicklerSerializer.Serialize[T](Stream stream, T value, FSharpOption`1 pickler, FSharpOption`1 streamingContext, FSharpOption`1 encoding, FSharpOption`1 leaveOpen) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\FsPickler\Serializer.fs:line 62
   at <StartupCode$FsPickler>.$Serializer.Pickle@155.Invoke(T v) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\FsPickler\Serializer.fs:line 155
   at MBrace.FsPickler.FsPicklerSerializer.Pickle[T](T value, FSharpOption`1 pickler, FSharpOption`1 streamingContext, FSharpOption`1 encoding) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\FsPickler\Serializer.fs:line 155
   at MBrace.FsPickler.Tests.FsPickler Serializer Tests.testRoundtrip[T](T x) in C:\Users\lr\Source\Repos\FsPickler\tests\FsPickler.Tests\SerializerTests.fs:line 37
   at <StartupCode$FsPickler-Tests>.$SerializerTests.test@1147-2.Invoke(Tuple`2 tupledArg) in C:\Users\lr\Source\Repos\FsPickler\tests\FsPickler.Tests\SerializerTests.fs:line 1147
eiriktsarpalis commented 6 years ago

This is a known bug in the ISerializable implementation for the particular type. I tried posting a PR for this but msft rejected it. I guess we could just filter out that particular type.

On Sun, 17 Sep 2017 at 18:49 Lukas Rieger notifications@github.com wrote:

One other thing I noticed - it is probably not relevant, but wanted to ask anyway:

On my local build and on appveyor, but not on travis, there is a warning in the output during one test:

***** MBrace.FsPickler.Tests.InMemory Tests("FsPickler.Binary").FsPickler Serializer Tests.8. Stress test: massively auto-generated objects Serializing 'System.NotFiniteNumberException' failed with error: MBrace.FsPickler.FsPicklerException: Error serializing object of type 'System.Object'. ---> System.InvalidCastException: Specified cast is not valid. at MBrace.FsPickler.Pickler1.UntypedWrite(WriteState state, String tag, Object value) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\Pickler\Pickler.fs:line 66 at <StartupCode$FsPickler>.$ISerializablePickler.writer@145-39.Invoke(WriteState w, String _arg1, T t) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\PicklerGeneration\ISerializablePickler.fs:line 149 at MBrace.FsPickler.CompositePickler1.Write(WriteState state, String tag, T value) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\Pickler\CompositePickler.fs:line 218 at MBrace.FsPickler.CompositePickler1.Write(WriteState state, String tag, T value) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\Pickler\CompositePickler.fs:line 196 at MBrace.FsPickler.RootSerialization.writeRootObject[T](IPicklerResolver resolver, ReflectionCache reflectionCache, IPickleFormatWriter formatter, FSharpOption1 streamingContext, FSharpOption1 sifter, Boolean isHash, Boolean disableSubtypes, Pickler1 pickler, T value) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\FsPickler\RootSerialization.fs:line 46 --- End of inner exception stack trace --- at MBrace.FsPickler.RootSerialization.writeRootObject[T](IPicklerResolver resolver, ReflectionCache reflectionCache, IPickleFormatWriter formatter, FSharpOption1 streamingContext, FSharpOption1 sifter, Boolean isHash, Boolean disableSubtypes, Pickler1 pickler, T value) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\FsPickler\RootSerialization.fs:line 50 at MBrace.FsPickler.FsPicklerSerializer.Serialize[T](Stream stream, T value, FSharpOption1 pickler, FSharpOption1 streamingContext, FSharpOption1 encoding, FSharpOption1 leaveOpen) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\FsPickler\Serializer.fs:line 62 at <StartupCode$FsPickler>.$Serializer.Pickle@155.Invoke(T v) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\FsPickler\Serializer.fs:line 155 at MBrace.FsPickler.FsPicklerSerializer.Pickle[T](T value, FSharpOption1 pickler, FSharpOption1 streamingContext, FSharpOption1 encoding) in C:\Users\lr\Source\Repos\FsPickler\src\FsPickler\FsPickler\Serializer.fs:line 155 at MBrace.FsPickler.Tests.FsPickler Serializer Tests.testRoundtrip[T](T x) in C:\Users\lr\Source\Repos\FsPickler\tests\FsPickler.Tests\SerializerTests.fs:line 37 at <StartupCode$FsPickler-Tests>.$SerializerTests.test@1147-2.Invoke(Tuple`2 tupledArg) in C:\Users\lr\Source\Repos\FsPickler\tests\FsPickler.Tests\SerializerTests.fs:line 1147

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/mbraceproject/FsPickler/pull/95#issuecomment-330065450, or mute the thread https://github.com/notifications/unsubscribe-auth/ACrts2AFwKZGfRjPGo2oNQm1m1bJzty4ks5sjVuigaJpZM4PaLIU .