Commit Graph
126 Commits
Author SHA1 Message Date
James Newton-King bf2e2a78e8 Add .NET 6 target (#2677) 2022-05-16 16:12:52 +08:00
James Newton-King af6e7b9c13 Refactor type name multidimensional array support and add tests 2021-11-14 18:04:58 +13:00
Jacky 233ed3a961 Correction for arrays of more than 2 dimensions
When using the type interpretation for arrays of more than 2 dimensions, on deserialization, an error is encountered.
There is a problem in the switch case that does not allow adding more than one comma between the brackets of System.xxxx [].
View issue #2591
2021-11-14 18:04:58 +13:00
James Newton-King cdf10151d5 Update Newtonsoft.Json project to use nullable reference types (#1950) 2019-07-29 09:13:42 +12:00
xp44mm 7cfeeac14a Update ReflectionUtils.cs#RemoveAssemblyDetails (#2006) 2019-03-30 14:37:29 +13:00
James Newton-King 03f7c0b859 Fix serializing types with struct ref properties (#1924) 2018-11-25 15:27:11 +13:00
James Newton-King d48558b53b Add support for NamingStrategy to StringEnumConverter (#1885) 2018-10-21 18:27:00 +13:00
James Newton-King 0ce23ff924 Refactor to use new C# language features (#1881)
* Use shorter default syntax
* Inline out variable declarations
* Pattern matching
2018-10-15 12:49:25 +13:00
James Newton-King 93fe3bd618 ReflectionUtils code clean up (#1755) 2018-07-01 15:25:36 +08:00
James Newton-King 6dd352c490 Fix calling constructors with ref and in parameters (#1728) 2018-05-29 10:46:51 +12:00
James Newton-King f2b6ea4966 -Fixed serializing generated types with duplicate property names 2018-02-22 15:15:55 +13:00
James Newton-King e370fc2e3a -Added readonly to structs 2018-01-31 10:32:50 +13:00
Jon Hanna 1b40ebfe26 Apply fix to #1460 to async writing. (#1540)
* Apply fix to #1460 to async writing.

* Replace recursion with iteration.

* Test for 1460 in async use.

* Change infinite loop style.
2017-12-20 16:06:07 +13:00
James Newton-King 473a7721bd -Refactor 2017-10-23 10:33:35 +13:00
James Newton-King ab3315f1d5 -Added netstandard2.0 2017-10-01 23:11:30 +13:00
James Newton-King fdbc400ceb -Added IgnoreShouldSerializeMembers to DefaultContractResolver
-Tests
2017-06-25 23:05:05 +12:00
James Newton-King aa5f28c097 -Added Portable40 back 2017-04-02 10:24:09 +12:00
James Newton-King ba514c4610 -Cleaned up preprocessor symbols 2017-03-05 15:12:52 +13:00
James Newton-King ba04246a16 -Improved SplitFullyQualifiedTypeName allocations 2017-01-13 01:07:13 +13:00
Florian Greinacher b8e60c773b Change ifdefs to be by feature, not by platform (#1146)
* First pass

* Second pass

* Third pass

* Temporarily change build script to build only portable

* Add portable features for release build

* Add feature constants to build script

* Add more feature constants to build script

* Fix build issues

* Fix build issues

* Get rid of constants in build.ps1

* HAVE_NUMERICS -> HAVE_BIG_INTEGER

* Remove HAVE_NULLABLE

* Remove HAVE_NUMERICS from csprojs

* Add missing ifdef

* Add feature defines to pj

* Re-enable netstd builds

* Fix defines in pj

* Trying to get better build outputs

* Trying to get the build error

* Use newer cli

* Address review feedback; make netstd build work

* Introduce HAVE_DB_NULL_TYPE

* Adapt to upstream changes; address remaining review feedback

* Adapt to upstream changes; address remaining review feedback

* Rename some constants for constistency

* Address review feedback

* -Fixed build with signed assembly

* Fix merge erorr

* Address review feedback

* Introduce HAVE_NON_SERIALIZED_ATTRIBUTE

* HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE
2017-01-12 11:07:02 +13:00
James Newton-King ba79136e4e Merge pull request #1151 from JonHanna/singleton_empty_array
Use singleton for zero-element arrays.
2017-01-09 15:11:14 +13:00
Jon Hanna ff3bfaf51b Use singleton for zero-element arrays.
Create an easily-inlinable method that accesses the array used
by Enumerable.Empty (and hence not just shared within this project
but likely with the client assembly or other libraries it uses)
and use it anywhere a zero-element array is used, reducing allocations.
2017-01-09 01:50:03 +00:00
Jon Hanna 859d12e338 Remove redundant call to Cast<>() (#1154) 2017-01-09 10:38:36 +13:00
Jon Hanna f4c17aedb2 Coalesce nulls rather than null test where applicable. (#1150) 2017-01-08 15:36:31 +13:00
James Newton-King 211b3b0db2 Merge pull request #1132 from JonHanna/favour_as_over_is
Replace is-and-cast with as-and-nullcheck
2017-01-05 17:00:42 +13:00
Jon Hanna a95665b481 Replace is-and-cast with as-and-nullcheck
Gives slightly better performance, so applying across the board
adds up.
2017-01-05 01:52:04 +00:00
James Newton-King 008a3c7655 Merge pull request #1126 from JonHanna/remove_list_array
Remove some unnecessary list and array allocations.
2017-01-05 11:32:37 +13:00
Jon Hanna d408066f64 Remove some unnecessary list and array allocations. 2017-01-04 22:22:26 +00:00
James Newton-King 306c3a812b Merge pull request #1125 from JonHanna/null_propogate
Use null-propogation where applicable and useful.
2017-01-05 11:15:49 +13:00
stakx 8639ac94ae Typos
Running a spell checker on the whole solution revealed a couple more
typos. This fixes all of those (although internal // line comments are
mostly left alone).

Additionally, convert a very few string.Format occurrences to the pre-
dominant .FormatWith pattern and fix some incorrect message strings.
2017-01-04 03:01:26 +01:00
Jon Hanna b567a066e6 Use null-propogation where applicable and useful.
Primarily where it means one fewer field-access or simplifies
event delegate invocation, though one or two cases have just the
lesser advantage of allowing an IL stack dup rather than local access.
2017-01-03 20:08:12 +00:00
James Newton-King be8ca7a870 -Refactor 2016-11-27 13:58:21 +13:00
James Newton-King 5269ce81c0 -Fixed serializing protected override properties 2016-11-27 13:33:52 +13:00
James Newton-King 38809c68e8 -Refactor away var 2016-11-07 13:33:53 -08:00
James Newton-King 7388358e0a -Clean up 2016-10-02 20:42:42 +13:00
James Newton-King d7125908ca -Merge 2016-09-17 17:15:35 +12:00
James Newton-King ca27a0fc3a -Added TypeNameAssemblyFormatHandling
-Added TypeNameAssemblyFormatHandling properties to JsonSerializer and JsonSerializerSettings
-Changed TypeNameAssemblyFormat properties on JsonSerializer and JsonSerializerSettings to obsolete
2016-09-17 15:57:03 +12:00
James Newton-King 4f8a22594f -Added ISerializationBinder
-Added SerializationBinder properties to JsonSerializer and JsonSerializerSettings
-Changed Binder properties on JsonSerializer and JsonSerializerSettings to obsolete
2016-09-16 16:10:13 +12:00
James Newton-King 68d160f3c6 -Added netstandard1.1 with BigInteger support 2016-09-10 23:54:44 +12:00
James Newton-King a8a9429b47 -DefaultSerializationBinder WIP 2016-08-09 18:30:17 +12:00
James Newton-King 86c2f80311 -Fixed JTokenWriter sometimes losing types when writing JToken 2016-04-29 16:21:41 +12:00
James Newton-King ce2a08dba2 -Formatting 2015-12-27 14:31:36 +13:00
Jon Hanna 7e6194b61b Use GetValueOrDefault() over Value when Nullable<T> known non-null
GetValueOrDefault() is an easily-inlined access to a field as this
will hold the correct value for both HasValue and !HasValue cases.
The Value property in comparison contains a branch on a check that the
Nullable<T> has its internal hasValue flag to decide whether to throw
InvalidOperationException or not.

Hence when a nullable type is known to have a value (not be null) and
one wants the value, rather than to possibly trigger the exception-throw
GetValueOrDefault() has a slight performance benefit over Value.

Accordingly, replace calls to the Value property with calls to
GetValueOrDefault() when previous checks or assignments guarantee the
value is not null.
2015-12-15 19:15:58 +00:00
James Newton-King 815b283e58 -Refactored buffer pool 2015-12-13 15:40:37 +13:00
James Newton-King eb0cbd6a75 -Formatting
-Build
2015-12-04 23:54:38 +13:00
Dmitry Kalyanov f3706313ef Compare BaseDefinition for properties when adding private properties.
Due to difference in mono vs .net (see https://bugzilla.xamarin.com/show_bug.cgi?id=36305),
MethodInfo.GetBaseDefinition() does not actually return base class (it returns partially-instantiated
generic class) in mono when overriding property from generic base class. Because of this, lookup
of matching property in ReflectionUtils.GetChildPrivateProperties() fails to find
already added property and adds the same property multiple times. Comparing GetBaseDefinition()'s
compensates for this: since the same function is applied to both PropertyInfo's, matching property
will be found.

This fixes issue #726.
2015-11-27 15:58:15 +03:00
James Newton-King fe7b7a6c7b -Added dotnet build
-Removed WinRT files
-Updated solution files to VS2015
-Updated psake
2015-08-02 23:56:26 +12:00
James Newton-King daf32bf571 -Fixed PR test 2015-04-03 12:10:23 +13:00
James Newton-King 5b392b54b8 -Clean up PR 2015-04-02 20:28:01 +13:00
ravensorb b7315c926b Added missing parameter to GetProperties call for nested interfaces 2015-04-01 23:13:30 -05:00