Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: aaubry/YamlDotNet
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf8ed3bfb692e0e517b536487078b72f24d13227
Choose a base ref
..
head repository: aaubry/YamlDotNet
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: efc6b10d2d62e844a6f4416a9a88494819341f12
Choose a head ref
Showing with 892 additions and 1,326 deletions.
  1. +0 −1 BuildUtils.UnityPrerequisites
  2. +1 −1 CONTRIBUTING.md
  3. +7 −7 Dockerfile
  4. +7 −6 Dockerfile.NonEnglish
  5. +0 −8 README.md
  6. +0 −6 YamlDotNet.AotTest/App.config
  7. +0 −130 YamlDotNet.AotTest/Program.cs
  8. +0 −34 YamlDotNet.AotTest/YamlDotNet.AotTest.csproj
  9. +0 −7 YamlDotNet.AotTest/run.sh
  10. +1 −1 YamlDotNet.Benchmark/YamlDotNet.Benchmark.csproj
  11. +0 −2 YamlDotNet.Core7AoTCompileTest.Model/YamlDotNet.Core7AoTCompileTest.Model.csproj
  12. +0 −2 YamlDotNet.Core7AoTCompileTest/YamlDotNet.Core7AoTCompileTest.csproj
  13. +1 −1 YamlDotNet.Samples/YamlDotNet.Samples.csproj
  14. +21 −0 YamlDotNet.Test/Analyzers/StaticGenerator/ObjectTests.cs
  15. +130 −0 YamlDotNet.Test/Serialization/PrivateConstructorTests.cs
  16. +90 −14 YamlDotNet.Test/Serialization/SerializationTests.cs
  17. +3 −2 YamlDotNet.Test/Serialization/TypeConverterTests.cs
  18. +11 −4 YamlDotNet.Test/Yaml.cs
  19. +1 −3 YamlDotNet.Test/YamlDotNet.Test.csproj
  20. +116 −0 YamlDotNet.Test/YamlTests.cs
  21. +3 −9 YamlDotNet.sln
  22. +6 −2 YamlDotNet/{Portability/netstandard2.0+netstandard2.1/include → }/CultureInfoAdapter.cs
  23. 0 YamlDotNet/{Portability/net35+unitysubset3.5/exclude → Helpers}/ReadOnlyCollectionExtensions.cs
  24. +0 −32 YamlDotNet/Portability/net35+unitysubset3.5+net45+net47/include/DeconstructionExtensions.cs
  25. +0 −67 YamlDotNet/Portability/net35+unitysubset3.5/include/ConcurrentDictionary.cs
  26. +0 −28 YamlDotNet/Portability/net35+unitysubset3.5/include/IReadOnlyCollection.cs
  27. +0 −34 YamlDotNet/Portability/net35+unitysubset3.5/include/IReadOnlyDictionary.cs
  28. +0 −28 YamlDotNet/Portability/net35+unitysubset3.5/include/IReadOnlyList.cs
  29. +0 −95 YamlDotNet/Portability/net35+unitysubset3.5/include/Lazy.cs
  30. +0 −38 YamlDotNet/Portability/net35+unitysubset3.5/include/Linq.cs
  31. +0 −83 YamlDotNet/Portability/net35+unitysubset3.5/include/ReadOnlyCollectionExtensions.cs
  32. +0 −50 YamlDotNet/Portability/net35+unitysubset3.5/include/ValueTuple.cs
  33. +0 −35 YamlDotNet/Portability/net45+net47/include/LazyBuilder.cs
  34. +0 −42 YamlDotNet/Portability/netstandard2.0+netstandard2.1/exclude/CultureInfoAdapter.cs
  35. +0 −174 YamlDotNet/Portability/netstandard2.0+netstandard2.1/exclude/ReflectionExtensions.cs
  36. +0 −31 YamlDotNet/Portability/unitysubset3.5/include/ExcludeFromCodeCoverageAttribute.cs
  37. +0 −33 YamlDotNet/Portability/unitysubset3.5/include/PropertyInfoExtensions.cs
  38. +0 −30 YamlDotNet/Portability/unitysubset3.5/include/StandardRegexOptions.cs
  39. +0 −38 YamlDotNet/Portability/unitysubset3.5/include/TargetFrameworkAttribute.cs
  40. 0 YamlDotNet/{Portability/unitysubset3.5/exclude → }/PropertyInfoExtensions.cs
  41. +9 −9 YamlDotNet/{Portability/netstandard2.0+netstandard2.1/include → }/ReflectionExtensions.cs
  42. +2 −2 YamlDotNet/Serialization/BufferedDeserialization/TypeDiscriminatingNodeDeserializer.cs
  43. +12 −0 YamlDotNet/Serialization/BuilderSkeleton.cs
  44. +13 −5 YamlDotNet/Serialization/DeserializerBuilder.cs
  45. +6 −8 YamlDotNet/Serialization/EventEmitters/JsonEventEmitter.cs
  46. +16 −43 YamlDotNet/Serialization/EventEmitters/TypeAssigningEventEmitter.cs
  47. +1 −0 YamlDotNet/Serialization/INamingConvention.cs
  48. +6 −0 YamlDotNet/Serialization/NamingConventions/CamelCaseNamingConvention.cs
  49. +6 −0 YamlDotNet/Serialization/NamingConventions/HyphenatedNamingConvention.cs
  50. +13 −0 YamlDotNet/Serialization/NamingConventions/LowerCaseNamingConvention.cs
  51. +6 −0 YamlDotNet/Serialization/NamingConventions/NullNamingConvention.cs
  52. +6 −0 YamlDotNet/Serialization/NamingConventions/PascalCaseNamingConvention.cs
  53. +6 −0 YamlDotNet/Serialization/NamingConventions/UnderscoredNamingConvention.cs
  54. +8 −1 YamlDotNet/Serialization/NodeDeserializers/ArrayNodeDeserializer.cs
  55. +7 −5 YamlDotNet/Serialization/NodeDeserializers/CollectionNodeDeserializer.cs
  56. +10 −3 YamlDotNet/Serialization/NodeDeserializers/ObjectNodeDeserializer.cs
  57. +7 −8 YamlDotNet/Serialization/NodeDeserializers/ScalarNodeDeserializer.cs
  58. +101 −4 YamlDotNet/Serialization/SerializerBuilder.cs
  59. +12 −0 YamlDotNet/Serialization/StaticBuilderSkeleton.cs
  60. +4 −3 YamlDotNet/Serialization/StaticDeserializerBuilder.cs
  61. +98 −4 YamlDotNet/Serialization/StaticSerializerBuilder.cs
  62. +2 −1 YamlDotNet/Serialization/Utilities/ITypeConverter.cs
  63. +1 −1 YamlDotNet/Serialization/Utilities/NullTypeConverter.cs
  64. +4 −1 YamlDotNet/Serialization/Utilities/ReflectionTypeConverter.cs
  65. +30 −18 YamlDotNet/Serialization/Utilities/TypeConverter.cs
  66. +8 −2 YamlDotNet/Serialization/ValueDeserializers/NodeValueDeserializer.cs
  67. +28 −0 YamlDotNet/Serialization/YamlFormatter.cs
  68. 0 YamlDotNet/{Portability/unitysubset3.5/exclude → }/StandardRegexOptions.cs
  69. +5 −32 YamlDotNet/YamlDotNet.csproj
  70. +4 −8 YamlDotNet/YamlDotNet.nuspec
  71. +4 −10 appveyor.yml
  72. +0 −5 build/common.props
  73. +0 −10 tools/aot/Dockerfile
  74. +0 −2 tools/aot/build.ps1
  75. +1 −1 tools/build/AutoNumberToStringConverter.cs
  76. +36 −52 tools/build/BuildDefinition.cs
  77. +19 −7 tools/build/Program.cs
  78. +3 −3 tools/build/build.csproj
1 change: 0 additions & 1 deletion BuildUtils.UnityPrerequisites
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ on the build variables.

Some platforms - such as IOS - forbid dynamic code generation. This prevents Just-in-Time compilation (JIT) from being used. In those cases, one can use Mono's Ahead-of-Time compilation (AOT). This results on a precompiled assembly that does not rely on JIT. There are [some limitations](http://www.mono-project.com/docs/advanced/aot/#limitation-generic-interface-instantiation) however, most of them are related to usage of generics.

In order to ensure that YamlDotNet is compatible with AOT compilation, an automatic test has been created that runs on every commit. That test exercises the serializer and deserializer to help identify AOT-related problems.
You can use the StaticSerializerBuilder and StaticDeserializerBuilder to accomplish this.

## Coding style

14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS builder
RUN apt update && \
apt install -y \
apt-transport-https \
@@ -16,39 +16,39 @@ RUN apt install -y wget
RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN apt update
RUN apt install -y dotnet-sdk-3.1 dotnet-sdk-6.0
RUN apt install -y dotnet-sdk-6.0
RUN apt install -y dotnet-sdk-7.0

FROM builder AS build
WORKDIR /src
ARG PACKAGE_VERSION=1.0.0

COPY YamlDotNet.sln YamlDotNet.sln
COPY YamlDotNet/YamlDotNet.csproj YamlDotNet/YamlDotNet.csproj
COPY YamlDotNet.AotTest/YamlDotNet.AotTest.csproj YamlDotNet.AotTest/YamlDotNet.AotTest.csproj
COPY YamlDotNet.Benchmark/YamlDotNet.Benchmark.csproj YamlDotNet.Benchmark/YamlDotNet.Benchmark.csproj
COPY YamlDotNet.Samples/YamlDotNet.Samples.csproj YamlDotNet.Samples/YamlDotNet.Samples.csproj
COPY YamlDotNet.Test/YamlDotNet.Test.csproj YamlDotNet.Test/YamlDotNet.Test.csproj
COPY YamlDotNet.Analyzers.StaticGenerator/YamlDotNet.Analyzers.StaticGenerator.csproj YamlDotNet.Analyzers.StaticGenerator/YamlDotNet.Analyzers.StaticGenerator.csproj
COPY YamlDotNet.Core7AoTCompileTest/YamlDotNet.Core7AoTCompileTest.csproj YamlDotNet.Core7AoTCompileTest/YamlDotNet.Core7AoTCompileTest.csproj
COPY YamlDotNet.Core7AoTCompileTest.Model/YamlDotNet.Core7AoTCompileTest.Model.csproj YamlDotNet.Core7AoTCompileTest.Model/YamlDotNet.Core7AoTCompileTest.Model.csproj
COPY YamlDotNet.Samples.Fsharp/YamlDotNet.Samples.Fsharp.fsproj YamlDotNet.Samples.Fsharp/YamlDotNet.Samples.Fsharp.fsproj

RUN dotnet restore YamlDotNet.sln

COPY . .

RUN dotnet build -c Release --framework net35 YamlDotNet/YamlDotNet.csproj -o /output/net35
RUN dotnet build -c Release --framework net40 YamlDotNet/YamlDotNet.csproj -o /output/net40
RUN dotnet build -c Release --framework net45 YamlDotNet/YamlDotNet.csproj -o /output/net45
RUN dotnet build -c Release --framework net47 YamlDotNet/YamlDotNet.csproj -o /output/net47
RUN dotnet build -c Release --framework netstandard2.0 YamlDotNet/YamlDotNet.csproj -o /output/netstandard2.0
RUN dotnet build -c Release --framework netstandard2.1 YamlDotNet/YamlDotNet.csproj -o /output/netstandard2.1
RUN dotnet build -c Release --framework net60 YamlDotNet/YamlDotNet.csproj -o /output/net60
RUN dotnet build -c Release --framework net70 YamlDotNet/YamlDotNet.csproj -o /output/net70
RUN dotnet build -c Release --framework net80 YamlDotNet/YamlDotNet.csproj -o /output/net80

RUN dotnet pack -c Release YamlDotNet/YamlDotNet.csproj -o /output/package /p:Version=$PACKAGE_VERSION

RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net80 --logger:"trx;LogFileName=/output/tests.net80.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net70 --logger:"trx;LogFileName=/output/tests.net70.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net60 --logger:"trx;LogFileName=/output/tests.net60.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework netcoreapp3.1 --logger:"trx;LogFileName=/output/tests.netcoreapp3.1.trx" --logger:"console;Verbosity=detailed"

FROM alpine
VOLUME /output
13 changes: 7 additions & 6 deletions Dockerfile.NonEnglish
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS builder
RUN apt update && \
apt install -y \
apt-transport-https \
@@ -17,7 +17,8 @@ RUN apt install -y wget
RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN apt update
RUN apt install -y dotnet-sdk-3.1 dotnet-sdk-6.0
RUN apt install -y dotnet-sdk-6.0
RUN apt install -y dotnet-sdk-7.0


FROM builder AS build
@@ -26,25 +27,24 @@ ARG PACKAGE_VERSION=1.0.0

COPY YamlDotNet.sln YamlDotNet.sln
COPY YamlDotNet/YamlDotNet.csproj YamlDotNet/YamlDotNet.csproj
COPY YamlDotNet.AotTest/YamlDotNet.AotTest.csproj YamlDotNet.AotTest/YamlDotNet.AotTest.csproj
COPY YamlDotNet.Benchmark/YamlDotNet.Benchmark.csproj YamlDotNet.Benchmark/YamlDotNet.Benchmark.csproj
COPY YamlDotNet.Samples/YamlDotNet.Samples.csproj YamlDotNet.Samples/YamlDotNet.Samples.csproj
COPY YamlDotNet.Test/YamlDotNet.Test.csproj YamlDotNet.Test/YamlDotNet.Test.csproj
COPY YamlDotNet.Analyzers.StaticGenerator/YamlDotNet.Analyzers.StaticGenerator.csproj YamlDotNet.Analyzers.StaticGenerator/YamlDotNet.Analyzers.StaticGenerator.csproj
COPY YamlDotNet.Core7AoTCompileTest/YamlDotNet.Core7AoTCompileTest.csproj YamlDotNet.Core7AoTCompileTest/YamlDotNet.Core7AoTCompileTest.csproj
COPY YamlDotNet.Core7AoTCompileTest.Model/YamlDotNet.Core7AoTCompileTest.Model.csproj YamlDotNet.Core7AoTCompileTest.Model/YamlDotNet.Core7AoTCompileTest.Model.csproj
COPY YamlDotNet.Samples.Fsharp/YamlDotNet.Samples.Fsharp.fsproj YamlDotNet.Samples.Fsharp/YamlDotNet.Samples.Fsharp.fsproj

RUN dotnet restore YamlDotNet.sln

COPY . .

RUN dotnet build -c Release --framework net35 YamlDotNet/YamlDotNet.csproj -o /output/net35
RUN dotnet build -c Release --framework net40 YamlDotNet/YamlDotNet.csproj -o /output/net40
RUN dotnet build -c Release --framework net45 YamlDotNet/YamlDotNet.csproj -o /output/net45
RUN dotnet build -c Release --framework net47 YamlDotNet/YamlDotNet.csproj -o /output/net47
RUN dotnet build -c Release --framework netstandard2.0 YamlDotNet/YamlDotNet.csproj -o /output/netstandard2.0
RUN dotnet build -c Release --framework netstandard2.1 YamlDotNet/YamlDotNet.csproj -o /output/netstandard2.1
RUN dotnet build -c Release --framework net60 YamlDotNet/YamlDotNet.csproj -o /output/net60
RUN dotnet build -c Release --framework net70 YamlDotNet/YamlDotNet.csproj -o /output/net70
RUN dotnet build -c Release --framework net80 YamlDotNet/YamlDotNet.csproj -o /output/net80

RUN dotnet pack -c Release YamlDotNet/YamlDotNet.csproj -o /output/package /p:Version=$PACKAGE_VERSION

@@ -62,6 +62,7 @@ RUN echo -n "${LC_ALL}" > /etc/locale.gen && \
apt install -y locales && \
locale-gen

RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net80 --logger:"trx;LogFileName=/output/tests.net80.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net70 --logger:"trx;LogFileName=/output/tests.net70.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework net60 --logger:"trx;LogFileName=/output/tests.net60.trx" --logger:"console;Verbosity=detailed"
RUN dotnet test -c Release YamlDotNet.Test/YamlDotNet.Test.csproj --framework netcoreapp3.1 --logger:"trx;LogFileName=/output/tests.netcoreapp3.1.trx" --logger:"console;Verbosity=detailed"
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -30,14 +30,6 @@ The library has now been successfully used in multiple projects and is considere
* .NET 6.0
* .NET 7.0
* .NET Framework 4.7
* .NET Framework 4.5
* Unity Subset v3.5

The following runtimes are also supported, with a few features missing:

* .NET Framework 3.5

The library is compatible with mono's [Ahead-of-Time compilation](https://www.mono-project.com/docs/advanced/aot/) (AOT), and should work correctly on platforms that depend on it, such as Unity.

## Quick start

6 changes: 0 additions & 6 deletions YamlDotNet.AotTest/App.config

This file was deleted.

130 changes: 0 additions & 130 deletions YamlDotNet.AotTest/Program.cs

This file was deleted.

34 changes: 0 additions & 34 deletions YamlDotNet.AotTest/YamlDotNet.AotTest.csproj

This file was deleted.

7 changes: 0 additions & 7 deletions YamlDotNet.AotTest/run.sh

This file was deleted.

2 changes: 1 addition & 1 deletion YamlDotNet.Benchmark/YamlDotNet.Benchmark.csproj
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net80</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Original file line number Diff line number Diff line change
@@ -6,6 +6,4 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<Import Project="../build/common.props" />

</Project>
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<Import Project="../build/common.props" />

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug-AOT|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
2 changes: 1 addition & 1 deletion YamlDotNet.Samples/YamlDotNet.Samples.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net60</TargetFramework>
<TargetFramework>net80</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

21 changes: 21 additions & 0 deletions YamlDotNet.Test/Analyzers/StaticGenerator/ObjectTests.cs
Original file line number Diff line number Diff line change
@@ -21,8 +21,10 @@

using System.Collections.Generic;
using Xunit;
using YamlDotNet.Core;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.Callbacks;
using YamlDotNet.Serialization.NamingConventions;

namespace YamlDotNet.Test.Analyzers.StaticGenerator
{
@@ -120,6 +122,25 @@ public void CallbacksAreExecuted()
Assert.Equal(1, test.OnSerializingCallCount);
}

[Fact]
public void NamingConventionAppliedToEnum()
{
var serializer = new StaticSerializerBuilder(new StaticContext()).WithEnumNamingConvention(CamelCaseNamingConvention.Instance).Build();
ScalarStyle style = ScalarStyle.Plain;
var serialized = serializer.Serialize(style);
Assert.Equal("plain", serialized.TrimNewLines());
}

[Fact]
public void NamingConventionAppliedToEnumWhenDeserializing()
{
var serializer = new StaticDeserializerBuilder(new StaticContext()).WithEnumNamingConvention(UnderscoredNamingConvention.Instance).Build();
var yaml = "Double_Quoted";
ScalarStyle expected = ScalarStyle.DoubleQuoted;
var actual = serializer.Deserialize<ScalarStyle>(yaml);
Assert.Equal(expected, actual);
}

[YamlSerializable]
public class TestState
{
Loading