Skip to content

Commit

Permalink
improve error messaging in struct record/union serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriktsarpalis committed Jun 7, 2017
1 parent c5b73fc commit 8b41901
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 37 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 3.3.0
* Improve error messaging on struct record/union serialization.

### 3.2.0
* Fix enum serialization for types that carry the DataContract attribute.

Expand Down
26 changes: 13 additions & 13 deletions src/FsPickler.CSharp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// <auto-generated/>
using System.Reflection;

[assembly: AssemblyProductAttribute("FsPickler")]
[assembly: AssemblyCopyrightAttribute("© Eirik Tsarpalis.")]
[assembly: AssemblyVersionAttribute("3.2.0")]
[assembly: AssemblyFileVersionAttribute("3.2.0")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "3.2.0";
internal const string InformationalVersion = "3.2.0";
}
}
// <auto-generated/>
using System.Reflection;

[assembly: AssemblyProductAttribute("FsPickler")]
[assembly: AssemblyCopyrightAttribute("© Eirik Tsarpalis.")]
[assembly: AssemblyVersionAttribute("3.3.0")]
[assembly: AssemblyFileVersionAttribute("3.3.0")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "3.3.0";
internal const string InformationalVersion = "3.3.0";
}
}
24 changes: 12 additions & 12 deletions src/FsPickler.Json/AssemblyInfo.fs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace System
open System.Reflection

[<assembly: AssemblyProductAttribute("FsPickler")>]
[<assembly: AssemblyCopyrightAttribute("© Eirik Tsarpalis.")>]
[<assembly: AssemblyVersionAttribute("3.2.0")>]
[<assembly: AssemblyFileVersionAttribute("3.2.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] Version = "3.2.0"
let [<Literal>] InformationalVersion = "3.2.0"
namespace System
open System.Reflection

[<assembly: AssemblyProductAttribute("FsPickler")>]
[<assembly: AssemblyCopyrightAttribute("© Eirik Tsarpalis.")>]
[<assembly: AssemblyVersionAttribute("3.3.0")>]
[<assembly: AssemblyFileVersionAttribute("3.3.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] Version = "3.3.0"
let [<Literal>] InformationalVersion = "3.3.0"
24 changes: 12 additions & 12 deletions src/FsPickler/AssemblyInfo.fs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace System
open System.Reflection

[<assembly: AssemblyProductAttribute("FsPickler")>]
[<assembly: AssemblyCopyrightAttribute("© Eirik Tsarpalis.")>]
[<assembly: AssemblyVersionAttribute("3.2.0")>]
[<assembly: AssemblyFileVersionAttribute("3.2.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] Version = "3.2.0"
let [<Literal>] InformationalVersion = "3.2.0"
namespace System
open System.Reflection

[<assembly: AssemblyProductAttribute("FsPickler")>]
[<assembly: AssemblyCopyrightAttribute("© Eirik Tsarpalis.")>]
[<assembly: AssemblyVersionAttribute("3.3.0")>]
[<assembly: AssemblyFileVersionAttribute("3.3.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] Version = "3.3.0"
let [<Literal>] InformationalVersion = "3.3.0"
8 changes: 8 additions & 0 deletions src/FsPickler/PicklerGeneration/FSharpTypeGen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ type internal FsUnionPickler =
if not (isReflectionSerializable ty || PicklerPluginRegistry.IsDeclaredSerializable ty) then
raise <| new NonSerializableTypeException(ty)

if ty.IsValueType then
// avoid emitting invalid IL for struct unions
raise <| new NonSerializableTypeException(ty, "Struct unions not supported.")

// Only cache by reference if typedef introduces custom or reference equality semantics
let isCacheByRef =
containsAttr<CustomEqualityAttribute> ty
Expand Down Expand Up @@ -252,6 +256,10 @@ type internal FsRecordPickler =
if not (isReflectionSerializable ty || PicklerPluginRegistry.IsDeclaredSerializable ty) then
raise <| new NonSerializableTypeException(ty)

if ty.IsValueType then
// avoid emitting invalid IL for struct records
raise <| new NonSerializableTypeException(ty, "Struct records not supported.")

let fields = FSharpType.GetRecordFields(ty, allMembers)
let ctor = FSharpValue.PreComputeRecordConstructorInfo(ty, allMembers)

Expand Down

0 comments on commit 8b41901

Please sign in to comment.