Skip to content

Commit 53bdaed

Browse files
authored
V8.3.2/yamldotnet fix (#70)
* ⬆️ updated to v16 due to aaubry/YamlDotNet#946 * 📝 updated changelog and release note * ⚗️ tweaking to reduce risk of failing test * ✏️ fixed .NET 7 mentions * ⚗️ works flawlessly locally; in GHA randomly fails - try increase jitter * ⚗️ unable to pass test although non-reproducable locally, extend logging and increase jitter * ⏪ back to 30 seconds sleep instead of 45 * ⚗️ tweaking to reduce risk of failing test * 🐛 fixed pipeline
1 parent 6646a3f commit 53bdaed

File tree

14 files changed

+90
-65
lines changed

14 files changed

+90
-65
lines changed

.github/workflows/pipelines.yml

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,11 @@ on:
2828
- Release
2929

3030
jobs:
31-
prepare:
32-
name: 🧰 Prepare
33-
strategy:
34-
matrix:
35-
os: [ubuntu-22.04, windows-2022] # had to add this due to caching issue
36-
runs-on: ${{ matrix.os }}
31+
prepare_linux:
32+
name: ✨ Prepare Linux Runner
33+
runs-on: ubuntu-22.04
3734
outputs:
3835
restoreCacheKey: ${{ steps.dotnet-restore.outputs.restoreCacheKey }}
39-
testProjects: ${{ steps.test-projects.outputs.result }}
4036
steps:
4137
- name: Checkout
4238
uses: codebeltnet/git-checkout@v1
@@ -50,11 +46,23 @@ jobs:
5046
with:
5147
useRestoreCache: true
5248

53-
- id: test-projects
54-
name: Generate matrix for test projects
55-
uses: codebeltnet/shell-globbing@v1
49+
prepare_windows:
50+
name: ✨ Prepare Windows Runner
51+
runs-on: windows-2022
52+
outputs:
53+
restoreCacheKey: ${{ steps.dotnet-restore.outputs.restoreCacheKey }}
54+
steps:
55+
- name: Checkout
56+
uses: codebeltnet/git-checkout@v1
57+
58+
- name: Install .NET
59+
uses: codebeltnet/install-dotnet@v1
60+
61+
- id: dotnet-restore
62+
name: Restore Dependencies
63+
uses: codebeltnet/dotnet-restore@v2
5664
with:
57-
pattern: test/**/*.csproj
65+
useRestoreCache: true
5866

5967
build:
6068
name: 🛠️ Build
@@ -63,9 +71,10 @@ jobs:
6371
matrix:
6472
configuration: [Debug, Release]
6573
framework: [net8.0, net6.0, netstandard2.1, netstandard2.0]
66-
needs: [prepare]
74+
needs: [prepare_linux]
6775
outputs:
6876
version: ${{ steps.minver-calculate.outputs.version }}
77+
testProjects: ${{ steps.test-projects.outputs.result }}
6978
steps:
7079
- name: Checkout
7180
uses: codebeltnet/git-checkout@v1
@@ -139,15 +148,21 @@ jobs:
139148
projects: ${{ env.PROJECTS }}
140149
configuration: ${{ matrix.configuration }}
141150
framework: ${{ matrix.framework }}
142-
restoreCacheKey: ${{ needs.prepare.outputs.restoreCacheKey }}
151+
restoreCacheKey: ${{ needs.prepare_linux.outputs.restoreCacheKey }}
152+
153+
- id: test-projects
154+
name: Generate matrix for test projects
155+
uses: codebeltnet/shell-globbing@v1
156+
with:
157+
pattern: test/**/*.csproj
143158

144159
pack:
145160
name: 📦 Pack
146161
runs-on: ubuntu-22.04
147162
strategy:
148163
matrix:
149164
configuration: [Debug, Release]
150-
needs: [prepare, build]
165+
needs: [prepare_linux, build]
151166
steps:
152167
- name: Checkout
153168
uses: codebeltnet/git-checkout@v1
@@ -158,18 +173,18 @@ jobs:
158173
configuration: ${{ matrix.configuration }}
159174
uploadPackedArtifact: true
160175
version: ${{ needs.build.outputs.version }}
161-
restoreCacheKey: ${{ needs.prepare.outputs.restoreCacheKey }}
176+
restoreCacheKey: ${{ needs.prepare_linux.outputs.restoreCacheKey }}
162177
downloadBuildArtifact: true
163178

164179
test:
165180
name: 🧪 Test
166-
needs: [prepare, build]
181+
needs: [build, prepare_linux, prepare_windows]
167182
strategy:
168183
fail-fast: false
169184
matrix:
170185
os: [ubuntu-22.04, windows-2022]
171186
configuration: [Debug, Release]
172-
project: ${{ fromJson(needs.prepare.outputs.testProjects) }}
187+
project: ${{ fromJson(needs.build.outputs.testProjects) }}
173188
runs-on: ${{ matrix.os }}
174189
steps:
175190
- name: Checkout
@@ -201,9 +216,9 @@ jobs:
201216
with:
202217
projects: ${{ matrix.project }}
203218
configuration: ${{ matrix.configuration }}
204-
restoreCacheKey: ${{ needs.prepare.outputs.restoreCacheKey }}
219+
restoreCacheKey: ${{ runner.os == 'Linux' && needs.prepare_linux.outputs.restoreCacheKey || needs.prepare_windows.outputs.restoreCacheKey }}
205220
buildSwitches: -p:SkipSignAssembly=true
206-
downloadBuildArtifact: true
221+
level: normal
207222
env:
208223
CONNECTIONSTRINGS__ADVENTUREWORKS: ${{ secrets.DB_ADVENTUREWORKS }}
209224

@@ -215,7 +230,7 @@ jobs:
215230

216231
sonarcloud:
217232
name: 🔬 Code Quality Analysis
218-
needs: [prepare, build, test]
233+
needs: [prepare_linux, build, test]
219234
runs-on: ubuntu-22.04
220235
steps:
221236
- name: Checkout
@@ -228,17 +243,10 @@ jobs:
228243
uses: codebeltnet/dotnet-tool-install-sonarscanner@v1
229244

230245
- name: Restore Dependencies
231-
uses: actions/cache/restore@v4
246+
uses: codebeltnet/dotnet-restore@v2
232247
with:
233-
path: |
234-
${{ github.workspace }}/src
235-
${{ github.workspace }}/test
236-
~/.nuget/packages
237-
key: ${{ needs.prepare.outputs.restoreCacheKey }}
238-
restore-keys: |
239-
dotnet-restore-
240-
enableCrossOsArchive: true
241-
fail-on-cache-miss: true
248+
useRestoreCache: true
249+
restoreCacheKey: ${{ needs.prepare_linux.outputs.restoreCacheKey }}
242250

243251
- name: Run SonarCloud Analysis
244252
uses: codebeltnet/sonarcloud-scan@v1
@@ -275,7 +283,7 @@ jobs:
275283

276284
codeql:
277285
name: 🛡️ Security Analysis
278-
needs: [prepare, build, test]
286+
needs: [prepare_linux, build, test]
279287
runs-on: ubuntu-22.04
280288
steps:
281289
- name: Checkout
@@ -285,17 +293,10 @@ jobs:
285293
uses: codebeltnet/install-dotnet@v1
286294

287295
- name: Restore Dependencies
288-
uses: actions/cache/restore@v4
296+
uses: codebeltnet/dotnet-restore@v2
289297
with:
290-
path: |
291-
${{ github.workspace }}/src
292-
${{ github.workspace }}/test
293-
~/.nuget/packages
294-
key: ${{ needs.prepare.outputs.restoreCacheKey }}
295-
restore-keys: |
296-
dotnet-restore-
297-
enableCrossOsArchive: true
298-
fail-on-cache-miss: true
298+
useRestoreCache: true
299+
restoreCacheKey: ${{ needs.prepare_linux.outputs.restoreCacheKey }}
299300

300301
- name: Prepare CodeQL SAST Analysis
301302
uses: codebeltnet/codeql-scan@v1

.nuget/Cuemon.Extensions.YamlDotNet/PackageReleaseNotes.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Availability: .NET 8, .NET 6 and .NET Standard 2.0
55
- REMOVED Support for TFM .NET 7 (STS)
66
- CHANGED Dependencies to latest and greatest with respect to TFMs
77

8+
# Bug Fixes
9+
- FIXED YamlFormatter class in the Cuemon.Extensions.YamlDotNet.Formatters namespace to use WithCaseInsensitivePropertyMatching (https://github.com/aaubry/YamlDotNet/discussions/946)
10+
 
811
Version 8.3.1
912
Availability: .NET 8, .NET 7, .NET 6 and .NET Standard 2.0
1013

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ This release was primarily focused on adapting a more modern way of performing C
4141
- Cuemon.Extensions.Xunit.Hosting.AspNetCore.Mvc updated to latest and greatest with respect to TFMs
4242
- Cuemon.Extensions.YamlDotNet updated to latest and greatest with respect to TFMs
4343

44+
### Fixed
45+
46+
- YamlFormatter class in the Cuemon.Extensions.YamlDotNet.Formatters namespace to use WithCaseInsensitivePropertyMatching (https://github.com/aaubry/YamlDotNet/discussions/946)
47+
- Although v16.0.0 of YamlDotNet has breaking changes, this is not reflected in the API from Cuemon.Extensions.YamlDotNet until next major release
48+
4449
### Added
4550

4651
- IWebHostTest interface in the Cuemon.Extensions.Xunit.Hosting.AspNetCore namespace that represents the members needed for ASP.NET Core (including but not limited to MVC, Razor and related) testing

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
# Cuemon for .NET
44

55
An open-source project (MIT license) that targets and complements the Microsoft .NET platform. It provides vast ways of possibilities for all breeds of coders, programmers, developers and the likes thereof.
6-
Your ideal companion for .NET 8, .NET 7, .NET 6, .NET Standard 2 and .NET Framework 4.6.2 and newer.
6+
Your ideal companion for .NET 8, .NET 6, .NET Standard 2 and .NET Framework 4.6.2 and newer.
77

88
It is, by heart, free, flexible and built to extend and boost your agile codebelt.
99

1010
## State of the Union
1111

12-
Cuemon for .NET (formerly Cuemon .NET Standard) has been completely refactored and updated to support .NET 8 (LTS), .NET 7 (STS) and .NET 6 (LTS).
12+
Cuemon for .NET (formerly Cuemon .NET Standard) has been completely refactored and updated to support .NET 8 (LTS) and .NET 6 (LTS).
1313

1414
Support for .NET Core 3.0, .NET Core 3.1, .NET 5 and .NET 7 has been deprecated as these are out of [support](https://endoflife.date/dotnet).
1515

src/Cuemon.Extensions.YamlDotNet/Converters/YamlConverter.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ namespace Cuemon.Extensions.YamlDotNet.Converters
1010
/// </summary>
1111
public abstract class YamlConverter : IYamlTypeConverter
1212
{
13-
internal abstract void WriteYamlCore(IEmitter writer, object value);
13+
internal abstract void WriteYamlCore(IEmitter writer, object value, ObjectSerializer serializer);
1414

15-
internal abstract object ReadYamlCore(IParser reader, Type typeToConvert);
15+
internal abstract object ReadYamlCore(IParser reader, Type typeToConvert, ObjectDeserializer deserializer);
1616

1717
/// <summary>
1818
/// Determines whether this instance can convert the specified object type.
@@ -43,14 +43,14 @@ bool IYamlTypeConverter.Accepts(Type type)
4343
return CanConvert(type);
4444
}
4545

46-
object IYamlTypeConverter.ReadYaml(IParser parser, Type type)
46+
object IYamlTypeConverter.ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer)
4747
{
48-
return ReadYamlCore(parser, type);
48+
return ReadYamlCore(parser, type, rootDeserializer);
4949
}
5050

51-
void IYamlTypeConverter.WriteYaml(IEmitter emitter, object value, Type type) // odd decision with type parameter
51+
void IYamlTypeConverter.WriteYaml(IEmitter emitter, object value, Type type, ObjectSerializer serializer)
5252
{
53-
WriteYamlCore(emitter, value);
53+
WriteYamlCore(emitter, value, serializer);
5454
}
5555
}
5656

@@ -76,12 +76,12 @@ public abstract class YamlConverter<T> : YamlConverter
7676
/// <returns>The converted value.</returns>
7777
public abstract T ReadYaml(IParser reader, Type typeToConvert);
7878

79-
internal override object ReadYamlCore(IParser reader, Type typeToConvert)
79+
internal override object ReadYamlCore(IParser reader, Type typeToConvert, ObjectDeserializer deserializer)
8080
{
8181
return ReadYaml(reader, typeToConvert);
8282
}
8383

84-
internal override void WriteYamlCore(IEmitter writer, object value)
84+
internal override void WriteYamlCore(IEmitter writer, object value, ObjectSerializer serializer)
8585
{
8686
WriteYaml(writer, (T)value);
8787
}

src/Cuemon.Extensions.YamlDotNet/Cuemon.Extensions.YamlDotNet.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="YamlDotNet" Version="15.3.0" />
13+
<PackageReference Include="YamlDotNet" Version="16.0.0" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

src/Cuemon.Extensions.YamlDotNet/Formatters/YamlFormatter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ public override object Deserialize(Stream value, Type objectType)
127127
var builder = new DeserializerBuilder()
128128
.WithNamingConvention(Options.Settings.NamingConvention)
129129
.WithEnumNamingConvention(Options.Settings.EnumNamingConvention)
130-
.WithYamlFormatter(Options.Settings.Formatter);
130+
.WithYamlFormatter(Options.Settings.Formatter)
131+
.WithCaseInsensitivePropertyMatching();
131132
if (Options.Settings.ReflectionRules.Flags.HasFlag(BindingFlags.NonPublic))
132133
{
133134
builder.IncludeNonPublicProperties();

src/Cuemon.Extensions.YamlDotNet/YamlConverterFactory.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using Cuemon.Extensions.YamlDotNet.Converters;
33
using YamlDotNet.Core;
4+
using YamlDotNet.Serialization;
45

56
namespace Cuemon.Extensions.YamlDotNet
67
{
@@ -74,13 +75,13 @@ internal DynamicConvertFactory(Func<Type, bool> predicate, Action<IEmitter, obje
7475

7576
private Func<IParser, Type, object> Reader { get; }
7677

77-
internal override void WriteYamlCore(IEmitter writer, object value)
78+
internal override void WriteYamlCore(IEmitter writer, object value, ObjectSerializer serializer)
7879
{
7980
if (Writer == null) { throw new NotImplementedException("Delegate writer is null."); }
8081
Writer.Invoke(writer, value);
8182
}
8283

83-
internal override object ReadYamlCore(IParser reader, Type typeToConvert)
84+
internal override object ReadYamlCore(IParser reader, Type typeToConvert, ObjectDeserializer deserializer)
8485
{
8586
if (Reader == null) { throw new NotImplementedException("Function delegate reader is null."); }
8687
return Reader.Invoke(reader, typeToConvert);

test/Cuemon.Data.SqlClient.Tests/SqlDatabaseDependencyTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public async Task StartAsync_ShouldReceiveTwoSignalsFromDatabaseWatcher()
3737
command.CommandText = "SELECT * FROM [Person].[ContactType]";
3838
return command.ExecuteReader();
3939

40-
}, o => o.Period = TimeSpan.FromMilliseconds(500)));
40+
}, o => o.Period = TimeSpan.FromMilliseconds(750)));
4141
var sut3 = new DatabaseDependency(sut2);
4242
var sut4 = DateTime.UtcNow;
4343
var sut5 = new List<DateTime>();
@@ -85,7 +85,7 @@ public async Task StartAsync_ShouldReceiveOnlyOneSignalFromDatabaseWatcher()
8585
command.CommandText = "SELECT * FROM [Person].[ContactType]";
8686
return command.ExecuteReader();
8787

88-
}, o => o.Period = TimeSpan.FromMilliseconds(500)));
88+
}, o => o.Period = TimeSpan.FromMilliseconds(550)));
8989
var sut3 = new DatabaseDependency(sut2, true);
9090
var sut4 = DateTime.UtcNow;
9191
var sut5 = new List<DateTime>();

test/Cuemon.Extensions.AspNetCore.Authentication.Tests/AuthorizationResponseHandlerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public async void AuthorizationResponseHandler_BasicScheme_ShouldRenderResponseU
242242
TestOutput.WriteLine(content);
243243

244244
Assert.Equal(HttpStatusCode.NotFound, result.StatusCode);
245-
245+
246246
if (sensitivityDetails == FaultSensitivityDetails.All)
247247
{
248248
Assert.Equal("""
@@ -1090,7 +1090,7 @@ public async void AuthorizationResponseHandler_BasicScheme_VerifyAsyncOptions_Sh
10901090
client.DefaultRequestHeaders.Add(HeaderNames.Authorization, bb.Build().ToString());
10911091
client.DefaultRequestHeaders.Add(HeaderNames.Accept, "text/plain");
10921092

1093-
for (var i = 0; i < 14; i++)
1093+
for (var i = 0; i < 12; i++)
10941094
{
10951095
var result = await client.GetAsync("/");
10961096
var content = await result.Content.ReadAsStringAsync();

0 commit comments

Comments
 (0)