Copied to clipboard

Flag this post as spam?

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


  • Pascal Ethier 2 posts 92 karma points
    Jul 19, 2018 @ 15:19
    Pascal Ethier
    0

    My URLSegmentProvider stopped being called

    Hello!

    I'm running into a weird snag where I have initially setup and properly configured and hooked up a URLSegmentProvider (implementing IURLSegmentProvider and adding it to the Resolver on ApplicationStarting) but now, it doesn't seem like it runs anymore.

    I use to just put a breakpoint in the GetUrlSegment() method of my provider and , in the backoffice, publish any node and it would get called. Now, that breakpoint no longer gets hit.

    Note that the breakpoint in my bootstrapper (ApplicationEventHandler sub-class) get's hit properly.

    It is as though, at some point, my custom URLSegmentProvider gets removed from the resolver. In fact, I have tried to remove the DefaultUrlSegmentProvider from the resolver before inserting my own UrlSegmentProvider type (in ApplicationStarting) and when publishing, I started getting a Ling .First() method error on the IEnumerable interface of the resolver saying that there is no element.

    I would really appreciate some help on this issue.

    Note that I have recently upgraded my database from v 7.10.4 to v7.11.1 ... that shouldn't make any difference though.

    Is there something I'm missing? I tried deleting the umbraco.config file and reseting iis to make sure nothing is cached.

    Thank you in advance!

  • Pascal Ethier 2 posts 92 karma points
    Jul 20, 2018 @ 17:27
    Pascal Ethier
    100

    We figured out what the issue was...

    Here are a few tips for those who experience similar issues:

    It turns out that we had defined a constructor on our implementation of IURLSegmentProvider for testing purposes but we had omitted to create a parameter-less constructor. In C#, this kind of thing will generate an error at run-time when the class is being instantiated without parameter (Duh!)

    1. Look at the logs.
      The error was silent while stepping through the code but looking at the the latest UmbracoTraceLog inside of "\App_data\Logs" actually revealed the error.

    2. Be aware of potential run-time errors that can occur.

Please Sign in or register to post replies

Write your reply to:

Draft