From b86b95eb907412d05ae1cd4a67dd75dc5e9f485f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 22:42:21 +0000 Subject: [PATCH 1/2] Initial plan From 68dcb3fef79e91fd4001df9b173f9d3e350271be Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 22:45:19 +0000 Subject: [PATCH 2/2] Replace Autofac with reflection-based assembly scanning Remove Autofac NuGet dependency and replace the DI container usage in Program.cs with simple reflection to discover and instantiate IDay implementations. Since none of the Day classes have constructor dependencies, a DI container is unnecessary. Co-authored-by: ianfnelson <205606+ianfnelson@users.noreply.github.com> --- AdventOfCode/AdventOfCode.csproj | 3 --- AdventOfCode/Program.cs | 15 ++++----------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/AdventOfCode/AdventOfCode.csproj b/AdventOfCode/AdventOfCode.csproj index 1c3758b..881282f 100644 --- a/AdventOfCode/AdventOfCode.csproj +++ b/AdventOfCode/AdventOfCode.csproj @@ -16,9 +16,6 @@ - - - diff --git a/AdventOfCode/Program.cs b/AdventOfCode/Program.cs index f3183db..9631ed2 100644 --- a/AdventOfCode/Program.cs +++ b/AdventOfCode/Program.cs @@ -1,24 +1,17 @@ using System.Diagnostics; using System.Reflection; using AdventOfCode.Framework; -using Autofac; -var container = BuildContainer(); - -var days = container.Resolve>(); +var days = Assembly.GetExecutingAssembly() + .GetTypes() + .Where(t => t is { IsClass: true, IsAbstract: false } && typeof(IDay).IsAssignableFrom(t)) + .Select(t => (IDay)Activator.CreateInstance(t)!); var day = GetDay(); Console.WriteLine("Year " + day.Year + " Day " + day.Day); var inputPath = $"Events/{day.Year}/InputFiles/{day.Day}.txt"; DoPart(1, () => day.Part1(inputPath)); DoPart(2, () => day.Part2(inputPath)); -IContainer BuildContainer() -{ - var builder = new ContainerBuilder(); - builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()).AsImplementedInterfaces(); - return builder.Build(); -} - IDay GetDay() { if (args.Length == 0)