Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Barloworld Motor Retail 5 posts 75 karma points
    Feb 20, 2019 @ 13:08
    Barloworld Motor Retail
    0

    Custom Workflow error with Autofac

    Hi

    Im getting the below when implementing Autofac on a custom workflow. "No parameterless constructor defined for this object"

    Logger: Umbraco.Forms.Core.Common.ProviderBase

    how do i register the workflow with Autofac?

    ---------------------Stack-------------------- [MissingMethodException: No parameterless constructor defined for this object.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +119 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232 System.Activator.CreateInstance(Type type, Boolean nonPublic) +83 System.Activator.CreateInstance(Type type) +11 Umbraco.Forms.Core.Common.ProviderCollection1.registerProviders(List1 types) +364 Umbraco.Forms.Core.Common.ProviderCollection1.initialize() +277 Umbraco.Forms.Core.Common.ProviderCollection1..ctor() +66 Umbraco.Forms.Core.Providers.WorkflowTypeProviderCollection..ctor() +4

    [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +119 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232 System.Activator.CreateInstance() +117 Umbraco.Forms.Core.Common.Nested..cctor() +94

    [TypeInitializationException: The type initializer for 'Nested' threw an exception.] Umbraco.Forms.Core.Common.Singleton`1.getInstance() +35 Umbraco.Forms.Core.Workflow.getType() +127

  • Yakov Lebski 553 posts 2117 karma points
    Feb 20, 2019 @ 20:27
    Yakov Lebski
    0

    I did not find a way to do it, the simplest way is use DependencyResolver.Current.GetService<IYOUSERVICE>()

  • Barloworld Motor Retail 5 posts 75 karma points
    Feb 21, 2019 @ 07:50
    Barloworld Motor Retail
    0

    I've tried property and Method injection and both values set on OnApplicationStarted but when the workflow kicks off and a new instance is created the property and Method are not reset and return a null reference.

    Any ideas?

Please Sign in or register to post replies

Write your reply to:

Draft