mbraceproject / FsPickler

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

Allow for assembly version independent object #3

Closed kjnilsson closed 10 years ago

kjnilsson commented 10 years ago

Not an issue - more of a feature request.

The ObjHeader type hash uses the AssemblyQualifiedName and thus encodes the assembly version into the hash. Would it be possibly to have a more lenient option where it will still attempt to deserialize the object independently of the version it was serialized against?

Cheers Karl

eiriktsarpalis commented 10 years ago

By default, AssemblyQualifiedName is used for serializing instances of System.Type, so it's an issue more general than hashes per se. However, this is behavior can be overridden by supplying a custom implementation of the ITypeNameConverter interface. This can be then assigned to the static FsCoreSerializerRegistry.TypeNameConverter property.

kjnilsson commented 10 years ago

Hi - thanks for this. Just got around to trying it. Seems the ITypeNameConverter interface was added after the current nuget release (5.2). Is the current code in a good enough state for another nuget release soon? Cheers. Karl

eiriktsarpalis commented 10 years ago

Hi, I'm currently working on a major revision of the library - breaking changes to the API included. I will post an update soon.

eiriktsarpalis commented 10 years ago

You'd be glad to know that I have updated the nuget package to address your issue. Serializing types with weak assembly names is now supported out of the box - although you will need to specify this explicitly. This can be done by defining an instance of DefaultTypeNameConverter with the strongNames parameter set to false. Custom ITypeNameConverter instances must be registered through the CustomPicklerRegistry mechanism.

Also, if you need to have weak names by default, you can always produce a custom build that changes the behaviour of the following snippet: https://github.com/eiriktsarpalis/FsPickler/blob/master/FsPickler/PicklerCache.fs#L57-L62

kjnilsson commented 10 years ago

:) - that's great - I've got a card for updating to FsPickler but not got around it yet. I shall try this shortly. Many thanks.

On 14 October 2013 10:51, Eirik Tsarpalis notifications@github.com wrote:

You'd be glad to know that I have updated the nuget package to address your issue. Serializing types with weak assembly names is now supported out of the box - although you will need to specify this explicitly. This can be done by defining an instance of DefaultTypeNameConverter with the strongNames parameter set to false. Custom ITypeNameConverter instances must be registered through the CustomPicklerRegistry mechanism.

Also, if you need to have weak names by default, you can always produce a custom build that changes the behaviour of the following snippet:

https://github.com/eiriktsarpalis/FsPickler/blob/master/FsPickler/PicklerCache.fs#L57-L62

— Reply to this email directly or view it on GitHubhttps://github.com/eiriktsarpalis/FsPickler/issues/3#issuecomment-26245773 .

Karl Nilsson twitter: @kjnilsson blog: coderkarl.wordpress.com