Git Product home page Git Product logo

autofac.diagnostics.dotgraph's Issues

Disconnected Operations - Owned/Lazy, etc

What do we think our options are, either around code changes, or documentation, for indicating diagnostics on 'disconnected' operations.

For example, with Owned instances, if I resolve a fairly simple set of dependencies 'normally':

image

When putting an Owned instance in the middle, I get the following graphs out (in this order):

image

image

I don't think there is anything particularly specific to the DotGraph implementation here, but I do wonder if we should figure out a way to associate the two sets of data together.

Automating DOT Diagram Generation

Problem Statement

It's really difficult to (:-P) use ingenious! package Autofac.Diagnostics.DotGraph. Namely, it is hand-heavy.

Desired Solution

See pull request.

Some of my steps have been automated (attempts to use asynchronous, parallel multi-threaded):

  1. Receive DOT output-folder
  2. CleanCodeAndImageFolders() <= cleans folders
  3. WriteDOTCode(args.TraceContent) <= write DOT per documentation
  4. GetImageFileFullPath(args.TraceContent) <= generate image filenames per DOT sources
  5. WriteDOTDiagram() <= use the DOT file to write-out the image at generated-filename.

Alternatives You've Considered

Autofac Analysis but I could not get it to function within the time I had.

Additional Context

ToDo1: Parameterize output paths, filename template
ToDo2: Remove performance test
ToDo3: Write functional test
ToDo4: Use plantUML?
ToDo5: Option to filter-out or partition Microsoft assembly-rooted diagrams?

Registering `DotDiagnosticTracer` in Autofac 8 causes MissingMethodException on any resolve

Describe the Bug

Seems the dot diagnostic tracer is incompatible with AF8.

Steps to Reproduce

  • Make a new C# project,
  • Add Autofac 8.0.0
  • Add Autofac.Diagnostics.DotGraph 1.0.0
using Autofac;
using Autofac.Diagnostics.DotGraph;

internal class Program {

    public class Foo {

    }

    private static void Main(string[] args) {

        var cb = new ContainerBuilder();

        cb.RegisterType<Foo>()
            .AsSelf()
            .SingleInstance();

        var scope = cb.Build();

        var tracer = new DotDiagnosticTracer();

        scope.SubscribeToDiagnostics(tracer);

        var foo = scope.Resolve<Foo>();   // <--- exception here

        Console.WriteLine("Hello, World!");
    }
}

Expected Behavior

No exceptions ๐Ÿ˜‰

Exception with Stack Trace

Autofac.Core.DependencyResolutionException
  HResult=0x80131500
  Message=An exception was thrown while executing a resolve operation. See the InnerException for details.
  Source=Autofac
  StackTrace:
   at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest& request)
   at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest& request)
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest& request)
   at Autofac.Core.Container.ResolveComponent(ResolveRequest& request)
   at Autofac.Core.Container.Autofac.IComponentContext.ResolveComponent(ResolveRequest& request)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context)
   at Program.Main(String[] args) in ....\Program.cs:line 24

  This exception was originally thrown at this call stack:
    Autofac.Diagnostics.DiagnosticTracerBase.Write(string, object)
    Autofac.Diagnostics.DiagnosticTracerBase.System.IObserver<System.Collections.Generic.KeyValuePair<string, object>>.OnNext(System.Collections.Generic.KeyValuePair<string, object>)
    System.Diagnostics.DiagnosticListener.Write(string, object)
    Autofac.Diagnostics.DiagnosticSourceExtensions.OperationStart(System.Diagnostics.DiagnosticListener, Autofac.Core.Resolving.IResolveOperation, Autofac.ResolveRequest)
    Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(Autofac.ResolveRequest)

Inner Exception 1:
MissingMethodException: Method not found: 'Autofac.ResolveRequest Autofac.Core.Resolving.IResolveOperation.get_InitiatingRequest()'.

Dependency Versions

Autofac: 8.0.0
Autofac.Diagnostics.DotGraph: 1.0.0

Additional Info

Things worked fine using AF 7.1. Also the dot diagnostics package does not have an upper version limit on its AF dependency, so did not expect things to blow with AF8.

Generic Type Names Display in Graphs

Do you think it's worth prettifying generic type names in the graph? For example, when I resolve an IEnumerable of a Service I get:

image

It might be nice to be able to give formatted generic names; people use generic services a lot.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.