From e7c6874ca4947b1224d46ceba64a54ee58a6e996 Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Wed, 15 Oct 2025 16:37:38 -0500 Subject: [PATCH] Just deleting the AssertWolverineConfigurationIsValid() API that doesn't work and adds no value. Closes GH-1734 --- docs/guide/diagnostics.md | 19 ------- .../Wolverine.Marten/Wolverine.Marten.csproj | 2 +- .../DocumentationSamples/DiagnosticSamples.cs | 16 ------ src/Testing/ConsoleApp/Program.cs | 2 + src/Wolverine/HostBuilderExtensions.cs | 51 ------------------- 5 files changed, 3 insertions(+), 87 deletions(-) delete mode 100644 src/Samples/DocumentationSamples/DiagnosticSamples.cs diff --git a/docs/guide/diagnostics.md b/docs/guide/diagnostics.md index f823a423c..e9581d446 100644 --- a/docs/guide/diagnostics.md +++ b/docs/guide/diagnostics.md @@ -136,25 +136,6 @@ using var host = await Host.CreateDefaultBuilder() snippet source | anchor -## Asserting Wolverine Configuration - -Probably mostly for testing projects, you can verify that all the message handlers and the underlying Lamar IoC container for your -application are in a valid state by executing this method: - - - -```cs -public static void assert_configuration_is_valid(IHost host) -{ - host.AssertWolverineConfigurationIsValid(); -} -``` -snippet source | anchor - - -Note that this method will attempt to generate and compile the source code for each message type and use [Lamar's own -diagnostics](https://jasperfx.github.io/lamar/guide/ioc/diagnostics/) as well. - ## Troubleshooting Message Routing Among other information, you can find a preview of how Wolverine will route known message types through the command line diff --git a/src/Persistence/Wolverine.Marten/Wolverine.Marten.csproj b/src/Persistence/Wolverine.Marten/Wolverine.Marten.csproj index fc5501733..57671e2fc 100644 --- a/src/Persistence/Wolverine.Marten/Wolverine.Marten.csproj +++ b/src/Persistence/Wolverine.Marten/Wolverine.Marten.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Samples/DocumentationSamples/DiagnosticSamples.cs b/src/Samples/DocumentationSamples/DiagnosticSamples.cs deleted file mode 100644 index 6b731017b..000000000 --- a/src/Samples/DocumentationSamples/DiagnosticSamples.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.Extensions.Hosting; -using Wolverine; - -namespace DocumentationSamples; - -public class DiagnosticSamples -{ - #region sample_using_AssertWolverineConfigurationIsValid - - public static void assert_configuration_is_valid(IHost host) - { - host.AssertWolverineConfigurationIsValid(); - } - - #endregion -} \ No newline at end of file diff --git a/src/Testing/ConsoleApp/Program.cs b/src/Testing/ConsoleApp/Program.cs index 1c46b8797..bad255254 100644 --- a/src/Testing/ConsoleApp/Program.cs +++ b/src/Testing/ConsoleApp/Program.cs @@ -33,6 +33,8 @@ private static Task Main(string[] args) opts.ListenToRabbitQueue("rabbit1"); opts.PublishAllMessages().ToRabbitQueue("rabbit2"); + + }).RunJasperFxCommands(args); } } diff --git a/src/Wolverine/HostBuilderExtensions.cs b/src/Wolverine/HostBuilderExtensions.cs index 344b76e52..67627693c 100644 --- a/src/Wolverine/HostBuilderExtensions.cs +++ b/src/Wolverine/HostBuilderExtensions.cs @@ -340,57 +340,6 @@ public static IServiceCollection AddAsyncWolverineExtension(this IServiceColl return services.AddSingleton(); } - public static void AssertWolverineConfigurationIsValid(this IHost host) - { - host.AssertAllGeneratedCodeCanCompile(); - } - - /// - /// Validate all of the Wolverine configuration of this Wolverine application. - /// This checks that all of the known generated code elements are valid - /// - /// - // TODO -- put this back into JasperFx.RuntimeCompiler! - public static void AssertAllGeneratedCodeCanCompile(this IHost host) - { - var exceptions = new List(); - var failures = new List(); - - var collections = host.Services.GetServices().ToArray(); - - var services = host.Services.GetService(); - - foreach (var collection in collections) - { - foreach (var file in collection.BuildFiles()) - { - var fileName = collection.ChildNamespace.Replace(".", "/").AppendPath(file.FileName); - - try - { - var assembly = new GeneratedAssembly(collection.Rules); - file.AssembleTypes(assembly); - new AssemblyGenerator().Compile(assembly, services); - - Debug.WriteLine($"U+2713 {fileName} "); - } - catch (Exception e) - { - Debug.WriteLine($"Failed: {fileName}"); - Debug.WriteLine(e); - - failures.Add(fileName); - exceptions.Add(e); - } - } - } - - if (failures.Any()) - { - throw new AggregateException($"Compilation failures for:\n{failures.Join("\n")}", exceptions); - } - } - /// /// Apply all asynchronous Wolverine configuration extensions to the Wolverine application. /// This is necessary if you are using Wolverine.HTTP endpoints