Added one more critical section to JSONMapper.Serialize(..)
parent
3677c6847b
commit
ccd0a507bc
|
@ -9,7 +9,7 @@
|
|||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<AssemblyVersion>0.1.0.0</AssemblyVersion>
|
||||
<FileVersion>0.1.0.0</FileVersion>
|
||||
<PackageVersion>1.2.3</PackageVersion>
|
||||
<PackageVersion>1.2.4</PackageVersion>
|
||||
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -154,6 +154,8 @@ namespace ln.json.mapping
|
|||
|
||||
|
||||
public virtual bool Serialize(object o, out JSONValue json)
|
||||
{
|
||||
lock (mappings)
|
||||
{
|
||||
if (object.ReferenceEquals(null, o))
|
||||
{
|
||||
|
@ -185,12 +187,14 @@ namespace ln.json.mapping
|
|||
{
|
||||
json = new JSONString(Enum.GetName(type, o));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type.IsPrimitive)
|
||||
{
|
||||
throw new NotSupportedException(String.Format("JSONMapperBase: Unsupported primitive type found: {0}", type));
|
||||
throw new NotSupportedException(
|
||||
String.Format("JSONMapperBase: Unsupported primitive type found: {0}", type));
|
||||
}
|
||||
|
||||
if (TryBuildRememberedMapping(type, out mapping))
|
||||
|
@ -201,6 +205,7 @@ namespace ln.json.mapping
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Deserialize<T>(string jsonSource, out T v) => Deserialize(JSONParser.Parse(jsonSource), out v);
|
||||
public virtual bool Deserialize<T>(JSONValue json, out T v)
|
||||
|
|
Loading…
Reference in New Issue