Copied to clipboard

Flag this post as spam?

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


  • Neil 40 posts 205 karma points
    Nov 28, 2022 @ 14:01
    Neil
    0

    500 error in umbraco-backoffice-extensions-js (NullReferenceException)

    I've found a couple of threads with a similar issue, but either the solution found was not relevelnt/didn't work, or no one gave a solution to try.

    I've discovered that on a .Net Core site (specifically v10.3.2), with Debug: false in the appsettings.config, custom property editors fail to load, because the compiled Smidge file /sb/umbraco-backoffice-extensions-js.js.{cachebuster} is throwing a 500 error - NullReferenceException: Object reference not set to an instance of an object.

    If you turn debug mode on (thus disabling Smidge's minification), it works fine, and it doesn't matter if you use UseInMemoryCache, or what CacheBuster method you choose.

    I've tried removing all custom property editors (by deleting App_Plugins, and doing a clean build) but the only difference this makes is the error changes from a NullRef to a ArgumentOutOfRangeException (Index was out of range. Must be non-negative and less than the size of the collection). I'm not sure if this is a related error, and the issue lies with Smidge, or this means the issue lies with one of our custom editors.

    I've also tried manually installing Smidge's latest version in the hopes that if it was an error in Smidge (and they've patched it) Umbraco would use the later version, but it either isn't Smidge/isn't patched or the package doesn't override the internal version. (I didn't hold out much hope but thought it was worth a try).

    Has anyone come across this and (more importantly) come up with a solution?

  • Neil 40 posts 205 karma points
    Nov 28, 2022 @ 15:15
    Neil
    100

    If it helps anyone else, the issue did lie in one of our custom plugins, the ArgumentOutOfRangeException was clearly a side effect of straight up removing App_Plugins without removing the use code.

    I cleared out the contents of every custom angular controller function, leaving the stubs intact and the issue dissapared. I then added the code back in, line-by-line until it crashed again.

    In my case, the culprit was that something in NUglify doesn't like the Array.from({length: n}, () => objDef) syntax, and swapping it for Array(n).fill(Object.assign({}, objDef) fixes the 500 error (while keeping my code working).

  • Thomas 319 posts 606 karma points c-trib
    Dec 15, 2022 @ 16:57
Please Sign in or register to post replies

Write your reply to:

Draft