diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 758a29ed6..84f8e8310 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -136,7 +136,7 @@ jobs: - name: Setup .NET 8 SDK uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 with: - dotnet-version: 8.0.x + dotnet-version: 11.0.x - name: Setup .NET SDK uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 diff --git a/.vscode/launch.json b/.vscode/launch.json index 5d872271f..3f0c4628e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/src/AdventOfCode.Site/bin/Debug/net10.0/AdventOfCode.Site.dll", + "program": "${workspaceFolder}/src/AdventOfCode.Site/bin/Debug/net11.0/AdventOfCode.Site.dll", "args": [], "cwd": "${workspaceFolder}/src/AdventOfCode.Site", "stopAtEntry": false, diff --git a/.vsconfig b/.vsconfig index 4f1026cce..1290e09b2 100644 --- a/.vsconfig +++ b/.vsconfig @@ -1,7 +1,7 @@ { "version": "1.0", "components": [ - "Microsoft.NetCore.Component.Runtime.10.0", + "Microsoft.NetCore.Component.Runtime.11.0", "Microsoft.NetCore.Component.SDK", "Microsoft.VisualStudio.Component.CoreEditor", "Microsoft.VisualStudio.Component.JavaScript.Diagnostics", diff --git a/Directory.Build.props b/Directory.Build.props index 2042b211d..d54fa27ca 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,9 @@ false true $(MSBuildThisFileDirectory)AdventOfCode.ruleset + $(Features);runtime-async=on false + preview true $(NoWarn);CS1591 false diff --git a/Directory.Packages.props b/Directory.Packages.props index cbc8b058b..0e73a5798 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,16 +7,16 @@ - + - - - + + + - + diff --git a/NuGet.config b/NuGet.config index 38ac8e75e..e432e5131 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,9 +2,13 @@ + + + + diff --git a/crank.yml b/crank.yml index 80e352ce6..fe5acb7dc 100644 --- a/crank.yml +++ b/crank.yml @@ -26,14 +26,14 @@ jobs: scenarios: microbenchmarks: application: - framework: net10.0 + framework: net11.0 job: microbenchmarks root: application: - framework: net10.0 + framework: net11.0 job: server load: - framework: net10.0 + framework: net11.0 job: bombardier variables: serverPort: 5000 diff --git a/global.json b/global.json index 343517d8f..9eae90ca6 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.301", + "version": "11.0.100-preview.5.26302.115", "allowPrerelease": false, "paths": [ ".dotnet", "$host$" ], "errorMessage": "The required version of the .NET SDK could not be found. Please run ./build.ps1 to bootstrap the .NET SDK." diff --git a/src/AdventOfCode.Console/AdventOfCode.Console.csproj b/src/AdventOfCode.Console/AdventOfCode.Console.csproj index 3aea583ad..f1e75ce5e 100644 --- a/src/AdventOfCode.Console/AdventOfCode.Console.csproj +++ b/src/AdventOfCode.Console/AdventOfCode.Console.csproj @@ -5,7 +5,7 @@ Speed Exe MartinCostello.AdventOfCode.Console - net10.0 + net11.0 diff --git a/src/AdventOfCode.Resources/AdventOfCode.Resources.csproj b/src/AdventOfCode.Resources/AdventOfCode.Resources.csproj index 25054ae56..f88954648 100644 --- a/src/AdventOfCode.Resources/AdventOfCode.Resources.csproj +++ b/src/AdventOfCode.Resources/AdventOfCode.Resources.csproj @@ -4,7 +4,7 @@ true Library MartinCostello.AdventOfCode - net10.0 + net11.0 diff --git a/src/AdventOfCode.Site/AdventOfCode.Site.csproj b/src/AdventOfCode.Site/AdventOfCode.Site.csproj index df5c6a3ad..2c761f82a 100644 --- a/src/AdventOfCode.Site/AdventOfCode.Site.csproj +++ b/src/AdventOfCode.Site/AdventOfCode.Site.csproj @@ -11,7 +11,7 @@ Exe true MartinCostello.AdventOfCode.Site - net10.0 + net11.0 true latest diff --git a/src/AdventOfCode.Site/aws-lambda-tools-defaults.json b/src/AdventOfCode.Site/aws-lambda-tools-defaults.json index 7666bff48..971bd51a3 100644 --- a/src/AdventOfCode.Site/aws-lambda-tools-defaults.json +++ b/src/AdventOfCode.Site/aws-lambda-tools-defaults.json @@ -2,7 +2,7 @@ "region": "eu-west-2", "profile": "", "configuration": "Release", - "framework": "net10.0", + "framework": "net11.0", "function-architecture": "arm64", "function-description": "The Advent of Code as a Service function.", "function-handler": "AdventOfCode.Site", diff --git a/src/AdventOfCode/AdventOfCode.csproj b/src/AdventOfCode/AdventOfCode.csproj index 2f4e8540a..9a8634ff1 100644 --- a/src/AdventOfCode/AdventOfCode.csproj +++ b/src/AdventOfCode/AdventOfCode.csproj @@ -6,7 +6,7 @@ $(NoWarn);CA1034;CA2007;CA2225;CA5351 Library MartinCostello.AdventOfCode - net10.0 + net11.0 diff --git a/src/AdventOfCode/PuzzleResult.cs b/src/AdventOfCode/PuzzleResult.cs index d245b42f7..c6fef42ff 100644 --- a/src/AdventOfCode/PuzzleResult.cs +++ b/src/AdventOfCode/PuzzleResult.cs @@ -11,12 +11,12 @@ public sealed class PuzzleResult /// /// Gets the solution(s) to the puzzle. /// - public IList Solutions { get; private set; } = new List(2); + public IList Solutions { get; private set; } = [with(2)]; /// /// Gets the visualization(s) associated with the puzzle, if any. /// - public IList Visualizations { get; private set; } = new List(2); + public IList Visualizations { get; private set; } = [with(2)]; /// /// Converts a puzzle result to a . diff --git a/src/AdventOfCode/Puzzles/Y2015/Day06.cs b/src/AdventOfCode/Puzzles/Y2015/Day06.cs index 5f4f9b1d2..c8007ef06 100644 --- a/src/AdventOfCode/Puzzles/Y2015/Day06.cs +++ b/src/AdventOfCode/Puzzles/Y2015/Day06.cs @@ -296,7 +296,7 @@ internal LightGrid(int width, int height) } _bounds = new(0, 0, width, height); - _lightBrightnesses = new(width * height); + _lightBrightnesses = [with(width * height)]; } /// diff --git a/src/AdventOfCode/Puzzles/Y2015/Day21.cs b/src/AdventOfCode/Puzzles/Y2015/Day21.cs index 0edf21566..381b4adc4 100644 --- a/src/AdventOfCode/Puzzles/Y2015/Day21.cs +++ b/src/AdventOfCode/Puzzles/Y2015/Day21.cs @@ -289,17 +289,17 @@ private sealed class Shop /// /// The shop's current armor inventory. This field is read-only. /// - private readonly Dictionary _armor = new(PotentialArmor); + private readonly Dictionary _armor = [with(PotentialArmor)]; /// /// The shop's current ring inventory. This field is read-only. /// - private readonly Dictionary _rings = new(PotentialRings); + private readonly Dictionary _rings = [with(PotentialRings)]; /// /// The shop's current weapon inventory. This field is read-only. /// - private readonly Dictionary _weapons = new(PotentialWeapons); + private readonly Dictionary _weapons = [with(PotentialWeapons)]; /// /// Purchases the specified armor. diff --git a/src/AdventOfCode/Puzzles/Y2016/Day11.cs b/src/AdventOfCode/Puzzles/Y2016/Day11.cs index 6366091f3..baa6ae0f9 100644 --- a/src/AdventOfCode/Puzzles/Y2016/Day11.cs +++ b/src/AdventOfCode/Puzzles/Y2016/Day11.cs @@ -79,7 +79,7 @@ protected override async Task SolveCoreAsync(string[] args, Cancel /// private static Dictionary> ParseInitialState(IList initialState) { - Dictionary> state = new(4); + Dictionary> state = [with(4)]; for (int i = 0; i < initialState.Count; i++) { diff --git a/src/AdventOfCode/Puzzles/Y2016/Day21.cs b/src/AdventOfCode/Puzzles/Y2016/Day21.cs index d7e7630fb..fec8d61f6 100644 --- a/src/AdventOfCode/Puzzles/Y2016/Day21.cs +++ b/src/AdventOfCode/Puzzles/Y2016/Day21.cs @@ -276,6 +276,8 @@ private static void SwapLetters(Span values, string x, string y) /// The index of the first location to swap. /// The index of the second location to swap. [MethodImpl(MethodImplOptions.AggressiveInlining)] +#pragma warning disable CA1517 // HACK https://github.com/dotnet/sdk/issues/53388 private static void SwapPosition(Span values, int x, int y) +#pragma warning disable CA1517 => (values[x], values[y]) = (values[y], values[x]); } diff --git a/src/AdventOfCode/Puzzles/Y2018/Day08.cs b/src/AdventOfCode/Puzzles/Y2018/Day08.cs index bf37a1cb4..1bb7b54fb 100644 --- a/src/AdventOfCode/Puzzles/Y2018/Day08.cs +++ b/src/AdventOfCode/Puzzles/Y2018/Day08.cs @@ -104,9 +104,9 @@ private sealed class Node(int childCount, int metadataCount) public int MetadataCount { get; init; } = metadataCount; - public List Children { get; } = new(childCount); + public List Children { get; } = [with(childCount)]; - public List Metadata { get; } = new(metadataCount); + public List Metadata { get; } = [with(metadataCount)]; public long MetadataSum { get; set; } diff --git a/src/AdventOfCode/Puzzles/Y2020/Day19.cs b/src/AdventOfCode/Puzzles/Y2020/Day19.cs index 77f16e59e..37d98d35e 100644 --- a/src/AdventOfCode/Puzzles/Y2020/Day19.cs +++ b/src/AdventOfCode/Puzzles/Y2020/Day19.cs @@ -47,7 +47,7 @@ public static int GetMatchCount(IList input, bool applyFix) static Dictionary ParseRules(IEnumerable input, int count) { - Dictionary> rawRules = new(count); + Dictionary> rawRules = [with(count)]; foreach (string rule in input) { diff --git a/src/AdventOfCode/Puzzles/Y2021/Day11.cs b/src/AdventOfCode/Puzzles/Y2021/Day11.cs index 9c6a7baa7..bc2e0b71c 100644 --- a/src/AdventOfCode/Puzzles/Y2021/Day11.cs +++ b/src/AdventOfCode/Puzzles/Y2021/Day11.cs @@ -42,7 +42,7 @@ public static (int Flashes100, int StepOfFirstSynchronizedFlash) Simulate(IList< for (int i = 0; i < steps; i++) { - current = new Dictionary(previous.Count); + current = [with(previous.Count)]; var pointsToFlash = new List(); diff --git a/src/AdventOfCode/Puzzles/Y2021/Day23.cs b/src/AdventOfCode/Puzzles/Y2021/Day23.cs index ed9732465..13ab8a0ef 100644 --- a/src/AdventOfCode/Puzzles/Y2021/Day23.cs +++ b/src/AdventOfCode/Puzzles/Y2021/Day23.cs @@ -256,7 +256,7 @@ public IEnumerable Neighbors(State id) continue; } - int firstSpace = burrow.LastIndexOf(' '); + int firstSpace = burrow.LastIndexOf(' ', StringComparison.Ordinal); string populated = Replace(burrow, amphipod, firstSpace); string newHallway = Replace(id.Hallway, ' ', space); diff --git a/src/AdventOfCode/Puzzles/Y2022/Day05.cs b/src/AdventOfCode/Puzzles/Y2022/Day05.cs index 68fe558ec..7861b52d0 100644 --- a/src/AdventOfCode/Puzzles/Y2022/Day05.cs +++ b/src/AdventOfCode/Puzzles/Y2022/Day05.cs @@ -34,7 +34,7 @@ static int GetStackCount(IList instructions) if (string.IsNullOrEmpty(instructions[i])) { string trimmed = instructions[i - 1].Trim(); - return Parse(trimmed[trimmed.LastIndexOf(' ')..]); + return Parse(trimmed[trimmed.LastIndexOf(' ', StringComparison.Ordinal)..]); } } diff --git a/src/AdventOfCode/Puzzles/Y2022/Day07.cs b/src/AdventOfCode/Puzzles/Y2022/Day07.cs index ab9162baf..5a34ac760 100644 --- a/src/AdventOfCode/Puzzles/Y2022/Day07.cs +++ b/src/AdventOfCode/Puzzles/Y2022/Day07.cs @@ -103,7 +103,7 @@ static int ParseEntries(Directory current, ReadOnlySpan terminalOutput) { string item = terminalOutput[i]; - if (item.StartsWith('$')) + if (item.StartsWith('$', StringComparison.Ordinal)) { count = i; break; diff --git a/src/AdventOfCode/Puzzles/Y2022/Day11.cs b/src/AdventOfCode/Puzzles/Y2022/Day11.cs index 51472d9d0..fc36673d3 100644 --- a/src/AdventOfCode/Puzzles/Y2022/Day11.cs +++ b/src/AdventOfCode/Puzzles/Y2022/Day11.cs @@ -80,7 +80,7 @@ static ICollection Parse(IList observations, bool highAnxiety) string operationString = operation[2..]; - if (operation.StartsWith('+')) + if (operation.StartsWith('+', StringComparison.Ordinal)) { if (operationString is "old") { @@ -92,7 +92,7 @@ static ICollection Parse(IList observations, bool highAnxiety) monkey.Inspector = (p) => p + operationValue; } } - else if (operation.StartsWith('*')) + else if (operation.StartsWith('*', StringComparison.Ordinal)) { if (operationString is "old") { diff --git a/src/AdventOfCode/Puzzles/Y2022/Day12.cs b/src/AdventOfCode/Puzzles/Y2022/Day12.cs index 68981f748..1bb1f5ef7 100644 --- a/src/AdventOfCode/Puzzles/Y2022/Day12.cs +++ b/src/AdventOfCode/Puzzles/Y2022/Day12.cs @@ -107,7 +107,7 @@ private sealed class Map : SquareGrid public Map(int width, int height) : base(width, height) { - Elevations = new(Width * Height); + Elevations = [with(Width * Height)]; } public Point Start { get; set; } diff --git a/src/AdventOfCode/Puzzles/Y2023/Day08.cs b/src/AdventOfCode/Puzzles/Y2023/Day08.cs index cf57e4bd8..0228e5dcb 100644 --- a/src/AdventOfCode/Puzzles/Y2023/Day08.cs +++ b/src/AdventOfCode/Puzzles/Y2023/Day08.cs @@ -28,8 +28,8 @@ public static long WalkNetwork(IList nodes, bool asGhost, CancellationTo if (asGhost) { - destination = (p) => p.EndsWith('Z'); - locations = [.. network.Edges.Keys.Where((p) => p.EndsWith('A'))]; + destination = (p) => p.EndsWith('Z', StringComparison.Ordinal); + locations = [.. network.Edges.Keys.Where((p) => p.EndsWith('A', StringComparison.Ordinal))]; } else { diff --git a/src/AdventOfCode/Puzzles/Y2023/Day12.cs b/src/AdventOfCode/Puzzles/Y2023/Day12.cs index 33cd05fd7..84213d7c2 100644 --- a/src/AdventOfCode/Puzzles/Y2023/Day12.cs +++ b/src/AdventOfCode/Puzzles/Y2023/Day12.cs @@ -166,7 +166,7 @@ public IEnumerable Neighbors(State id) yield return new State(next, id.Counts, id.Actual + 1, id.Desired); - i = springs.IndexOf(Unknown, i + 1); + i = springs.IndexOf(Unknown, i + 1, StringComparison.Ordinal); } } } diff --git a/src/AdventOfCode/Puzzles/Y2023/Day22.cs b/src/AdventOfCode/Puzzles/Y2023/Day22.cs index 021d389cc..e1437e6ec 100644 --- a/src/AdventOfCode/Puzzles/Y2023/Day22.cs +++ b/src/AdventOfCode/Puzzles/Y2023/Day22.cs @@ -115,7 +115,7 @@ static Vector3 ParseVector(ReadOnlySpan value) if (transform != Vector3.Zero) { - transformed = new HashSet(cubes!.Length); + transformed = [with(cubes!.Length)]; for (int i = 0; i < cubes.Length; i++) { diff --git a/src/AdventOfCode/Puzzles/Y2024/Day01.cs b/src/AdventOfCode/Puzzles/Y2024/Day01.cs index fd9732cc0..3573bb506 100644 --- a/src/AdventOfCode/Puzzles/Y2024/Day01.cs +++ b/src/AdventOfCode/Puzzles/Y2024/Day01.cs @@ -19,8 +19,8 @@ public sealed class Day01 : Puzzle /// public static (int TotalDistance, int SimilarityScore) ParseList(IList values) { - List first = new(values.Count); - List second = new(values.Count); + List first = [with(values.Count)]; + List second = [with(values.Count)]; foreach (string pair in values) { diff --git a/src/AdventOfCode/Puzzles/Y2024/Day10.cs b/src/AdventOfCode/Puzzles/Y2024/Day10.cs index 12854f29f..9da854bc6 100644 --- a/src/AdventOfCode/Puzzles/Y2024/Day10.cs +++ b/src/AdventOfCode/Puzzles/Y2024/Day10.cs @@ -89,6 +89,6 @@ protected override async Task SolveCoreAsync(string[] args, Cancel private sealed class TopographicMap(Rectangle bounds) : SquareGrid(bounds) { - public Dictionary Heights { get; } = new(bounds.Area()); + public Dictionary Heights { get; } = [with(bounds.Area())]; } } diff --git a/src/AdventOfCode/Puzzles/Y2025/Day12.cs b/src/AdventOfCode/Puzzles/Y2025/Day12.cs index e1781cf1b..886c190a0 100644 --- a/src/AdventOfCode/Puzzles/Y2025/Day12.cs +++ b/src/AdventOfCode/Puzzles/Y2025/Day12.cs @@ -292,7 +292,7 @@ public HashSet Empty() private sealed class Shape(int index, int capacity) : HashSet(capacity) { - private readonly List _transformations = new(8); + private readonly List _transformations = [with(8)]; public int Index { get; } = index; diff --git a/startvscode.cmd b/startvscode.cmd index 91142b503..5a0355319 100644 --- a/startvscode.cmd +++ b/startvscode.cmd @@ -11,7 +11,7 @@ SET DOTNET_ROOT(x86)=%~dp0.dotnet\x86 SET PATH=%DOTNET_ROOT%;%PATH% :: Sets the Target Framework for Visual Studio Code. -SET TARGET=net10.0 +SET TARGET=net11.0 SET FOLDER=%~1 diff --git a/tests/AdventOfCode.Benchmarks/AdventOfCode.Benchmarks.csproj b/tests/AdventOfCode.Benchmarks/AdventOfCode.Benchmarks.csproj index a7e920da4..5fe766925 100644 --- a/tests/AdventOfCode.Benchmarks/AdventOfCode.Benchmarks.csproj +++ b/tests/AdventOfCode.Benchmarks/AdventOfCode.Benchmarks.csproj @@ -5,7 +5,7 @@ $(NoWarn);CA1034;CA1056;CA1819;CA2007;SA1600 Exe MartinCostello.AdventOfCode.Benchmarks - net10.0 + net11.0 diff --git a/tests/AdventOfCode.Benchmarks/Program.cs b/tests/AdventOfCode.Benchmarks/Program.cs index a08e8b9b9..730957528 100644 --- a/tests/AdventOfCode.Benchmarks/Program.cs +++ b/tests/AdventOfCode.Benchmarks/Program.cs @@ -4,5 +4,5 @@ using BenchmarkDotNet.Running; using MartinCostello.AdventOfCode.Benchmarks; -var summary = BenchmarkRunner.Run(args: args); +var summary = await BenchmarkRunner.RunAsync(args: args); return summary.Reports.Any((p) => !p.Success) ? 1 : 0; diff --git a/tests/AdventOfCode.Tests/AdventOfCode.Tests.csproj b/tests/AdventOfCode.Tests/AdventOfCode.Tests.csproj index 1812e9f23..f088e3d65 100644 --- a/tests/AdventOfCode.Tests/AdventOfCode.Tests.csproj +++ b/tests/AdventOfCode.Tests/AdventOfCode.Tests.csproj @@ -4,7 +4,7 @@ $(NoWarn);xUnit1004 Exe MartinCostello.AdventOfCode - net10.0 + net11.0 true true