Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions docs/guide/diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,6 @@ using var host = await Host.CreateDefaultBuilder()
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Samples/DocumentationSamples/HandlerDiscoverySamples.cs#L148-L160' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_describe_handler_match' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

## 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:

<!-- snippet: sample_using_AssertWolverineConfigurationIsValid -->
<a id='snippet-sample_using_assertwolverineconfigurationisvalid'></a>
```cs
public static void assert_configuration_is_valid(IHost host)
{
host.AssertWolverineConfigurationIsValid();
}
```
<sup><a href='https://github.com/JasperFx/wolverine/blob/main/src/Samples/DocumentationSamples/DiagnosticSamples.cs#L8-L15' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_using_assertwolverineconfigurationisvalid' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

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
Expand Down
2 changes: 1 addition & 1 deletion src/Persistence/Wolverine.Marten/Wolverine.Marten.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ProjectReference Include="..\Wolverine.Postgresql\Wolverine.Postgresql.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Marten" Version="8.13.0" />
<PackageReference Include="Marten" Version="8.13.1" />
</ItemGroup>
<Import Project="../../../Analysis.Build.props" />
</Project>
16 changes: 0 additions & 16 deletions src/Samples/DocumentationSamples/DiagnosticSamples.cs

This file was deleted.

2 changes: 2 additions & 0 deletions src/Testing/ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ private static Task<int> Main(string[] args)

opts.ListenToRabbitQueue("rabbit1");
opts.PublishAllMessages().ToRabbitQueue("rabbit2");


}).RunJasperFxCommands(args);
}
}
Expand Down
51 changes: 0 additions & 51 deletions src/Wolverine/HostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,57 +340,6 @@ public static IServiceCollection AddAsyncWolverineExtension<T>(this IServiceColl
return services.AddSingleton<IAsyncWolverineExtension, T>();
}

public static void AssertWolverineConfigurationIsValid(this IHost host)
{
host.AssertAllGeneratedCodeCanCompile();
}

/// <summary>
/// Validate all of the Wolverine configuration of this Wolverine application.
/// This checks that all of the known generated code elements are valid
/// </summary>
/// <param name="host"></param>
// TODO -- put this back into JasperFx.RuntimeCompiler!
public static void AssertAllGeneratedCodeCanCompile(this IHost host)
{
var exceptions = new List<Exception>();
var failures = new List<string>();

var collections = host.Services.GetServices<ICodeFileCollection>().ToArray();

var services = host.Services.GetService<IServiceVariableSource>();

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);
}
}

/// <summary>
/// Apply all asynchronous Wolverine configuration extensions to the Wolverine application.
/// This is necessary if you are using Wolverine.HTTP endpoints
Expand Down
Loading