OfficeDev / script-lab

Create, run and share your code directly from Office
MIT License
704 stars 162 forks source link

Error if custom function IDs are the same ignoring periods and underscore #1009

Open parched opened 1 year ago

parched commented 1 year ago

Bug Report

Expected behavior:

I expect to be able to create two functions that have different IDs ignore case.

Actual behavior:

Steps to Reproduce:

/**
 * Calculates the volume of a sphere.
 * @customfunction SPHERE_VOL
 * @param {number} radius
 * @returns The volume of the sphere.
 */
function sphereVolume(radius) {
  return (Math.pow(radius, 3) * 4 * Math.PI) / 3;
}

/**
 * Calculates the volume of a sphere.
 * @customfunction SPHERE.VOL
 * @param {number} radius
 * @returns The volume of the sphere.
 */
function sphereVolume2(radius) {
  return (Math.pow(radius, 3) * 4 * Math.PI) / 3;
}

Failure Logs:

Error:
{
    "stack": "RichApi.Error: The request is aborted.\n    at new n (https://appsforoffice.microsoft.com/lib/beta/hosted/excel-win32-16.01.js:26:258943)\n    at o.processRequestExecutorResponseMessage (https://appsforoffice.microsoft.com/lib/beta/hosted/excel-win32-16.01.js:26:323277)\n    at https://appsforoffice.microsoft.com/lib/beta/hosted/excel-win32-16.01.js:26:321339",
    "message": "The request is aborted.",
    "name": "RichApi.Error",
    "code": "RequestAborted",
    "traceMessages": [],
    "innerError": null,
    "debugInfo": {
        "code": "RequestAborted",
        "message": "The request is aborted.",
        "errorLocation": "CustomFunctionManager.register",
        "statement": "v.register(...);",
        "surroundingStatements": [
            "var workbook = context.workbook;",
            "var v = Microsoft.ExcelServices.CustomFunctionManager.newObject();",
            "// >>>>>",
            "v.register(...);",
            "// <<<<<"
        ],
        "fullStatements": [
            "Please enable config.extendedErrorLogging to see full statements."
        ]
    },
    "httpStatusCode": 500
}

Screenshot:

This is what it looks like after that error. It says they have been registered correctly, but clearly have not.

image

alison-mk commented 1 year ago

Hi @parched, thanks for submitting this issue.

@jiju-MS Can you take a look at this custom functions issue in the Script Lab repository?