Custom exception types not marked as serializable
denniskrq opened this issue · 5 comments
The custom exception types of the library are not marked as Serializable and are causing this exception: System.Runtime.Serialization.SerializationException: Type 'BCrypt.Net.SaltParseException' in Assembly 'BCrypt.Net-Next.StrongName, Version=3.1.0.0, Culture=neutral, PublicKeyToken=1e11be04b6288443' is not marked as serializable.
When they are received by a caller in a different AppDomain in my implementation.
All 3 types have no particular customized details preventing them from being serializable, so I hope this is as simple as adding the [Serializable()]
attribute before their declarations.
Yeah; it was dropped during netcore 1.1 days as binary object serializer was killed off and this attribute as well. Now its present on a subset of objects https://docs.microsoft.com/en-us/dotnet/standard/serialization/binary-serialization#binary-serialization-in-net-core including exception I think I can add it back without causing any knock on issues.
Out of interest what version of .net are you using?
My implementation targets .NET Framework 4.6. Migration to Standard is on the roadmap but no concrete date yet.
Should be sorted in 3.1.3 (which is in nuget)
You can change to https://www.nuget.org/packages/BCrypt.Net-Next/ by the way; it's strong signed like the other (msft changed its advice last year)
Do we really need all the netstandard2.0 dependencies appeared in 3.1.3 just to add a [Serializable] attribute?