2

We are upgrading to SC9.3. A custom class UserRequestProcessor which inherits from ExecuteRequest has errors now, as the new ExecuteRequest class in not a parameterless constructor anymore.

The solution provided here did not work.

public class UserRequestProcessor : ExecuteRequest
{
        public UserRequestProcessor(BaseSiteManager baseSiteManager, BaseItemManager baseItemManager)
            : this(baseSiteManager, baseItemManager)

        {
        }
}

There is an error at this in the constructor, which says:

UserRequestProcessor.UserRequestProcessor(BaseSiteManager baseSiteManager, BaseItemManager baseItemManager) cannot call itself.

How to modify the custom class to fix this issue.

UPDATE:
Changing this to base fixed the issue and does not give any build errors. However, deploying the code, there was an error:

Could not create instance of type: Sitecore.Foundation.RequestFilter.Pipeline.UserRequestProcessor. No matching constructor was found.

To fix that, I had to add resolve="true" in the patch config like this:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <httpRequestProcessed>
        <processor patch:after="*[@type='Sitecore.Pipelines.HttpRequest.ExecuteRequest, Sitecore.Kernel']"
          type="Sitecore.Foundation.RequestFilter.Pipeline.UserRequestProcessor, Sitecore.Foundation.RequestFilter" resolve="true"/>
      </httpRequestProcessed>
    </pipelines>
  </sitecore>
</configuration>
1
  • 1
    Use base(baseSiteManager, baseItemManager) instead of this(baseSiteManager, baseItemManager)
    – Marek Musielak
    Feb 4, 2020 at 7:19

1 Answer 1

3

You don't want to call

: this(baseSiteManager, baseItemManager)

as that would mean you have recursive call to your UserRequestProcessor contructor again and that would mean infinite loop.

What you want to do is to call

: base(baseSiteManager, baseItemManager)

which means "call the base class constructor with parameters (baseSiteManager, baseItemManager).

1
  • Thank you. That fixed the build issue but on deployment it threw an error. To fix it, I had to add resolve="true" in the patch config for the processor setting. Updated the same in the question.
    – sukesh
    Feb 5, 2020 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.