Autofac.Diagnostics.DotGraph 2.0.0

Prefix Reserved
dotnet add package Autofac.Diagnostics.DotGraph --version 2.0.0                
NuGet\Install-Package Autofac.Diagnostics.DotGraph -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Autofac.Diagnostics.DotGraph" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Autofac.Diagnostics.DotGraph --version 2.0.0                
#r "nuget: Autofac.Diagnostics.DotGraph, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Autofac.Diagnostics.DotGraph as a Cake Addin
#addin nuget:?package=Autofac.Diagnostics.DotGraph&version=2.0.0

// Install Autofac.Diagnostics.DotGraph as a Cake Tool
#tool nuget:?package=Autofac.Diagnostics.DotGraph&version=2.0.0                

Autofac.Diagnostics.DotGraph

Autofac diagnostics support to enable DOT graph visualization of resolve requests.

Build status

Please file issues and pull requests for this package in this repository rather than in the Autofac core repo.

Quick Start

After building your container, attach the Autofac.Diagnostics.DotGraph.DotDiagnosticTracer to the container. When every resolve operation completes (success or failure) you'll get a trace. It's up to you to determine what to do with that trace - write it to a file, render it to an image, etc.

// Build a container with some registrations.
var containerBuilder = new ContainerBuilder();
containerBuilder.Register(ctx => "Hello");
var container = containerBuilder.Build();

// Attach a DotDiagnosticTracer to the container.
// Handle the OperationCompleted event to deal
// with the trace output.
var tracer = new DotDiagnosticTracer();
tracer.OperationCompleted += (sender, args) =>
{
  using var file = File.OpenWrite(Guid.NewGuid().ToString() + ".dot");
  using var writer = new StreamWriter(file);
  writer.WriteLine(args.TraceContent);
};
container.SubscribeToDiagnostics(tracer);

// Resolve some things and look at the graphs!
// You can use graphviz to render a PNG like:
// dot -T png -O filename.dot
using var scope = container.BeginLifetimeScope();
scope.Resolve<string>();

Tracing graphs is expensive! Getting a graph trace is convenient but does have a performance and memory/resource impact. It's recommended you only enable this in a development/troubleshooting situation.

Get Help

Need help with Autofac? We have a documentation site as well as API documentation. We're ready to answer your questions on Stack Overflow or check out the discussion forum.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 2,320 5/24/2024
1.0.0 3,509,450 9/28/2020