Overriding dialogField lookup with registerOverrideMethod

I try to create a custom lookup for my dialogField however no lookup opens when I click dropdown.

Here is my code.

protected Object dialog()
    Dialog ret;

    ret = super();

    dlgOperatorCode = ret.addField(extendedTypeStr(LGSPerformerCode), '', '', true);
        dlgOperatorCode.enabled(false); // Make it read only when default value is set

    dlgOperatorName = ret.addFieldValue(extendedTypeStr(LGSName), operatorName);
    dlgOperatorCountry = ret.addFieldValue(extendedTypeStr(AddressCountryRegionId), operatorCountry);

    dlgOperatorCountry.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(LGSCreateOperatorDialog, countryLookup), this);

    return ret;

and my lookup (I know it looks simple enough that i woudnt need custom, but I reduced it to a minimum for this case):

public void countryLookup(FormStringControl _control)
    SysTableLookup          sysTableLookup;

    sysTableLookup = SysTableLookup::newParameters(tableNum(LogisticsAddressCountryRegion), _control);

    sysTableLookup.addLookupfield(fieldNum(LogisticsAddressCountryRegion, CountryRegionId));



Both methods are in the same RunBase class (LGSCreateOperatorDialog). I think I’ve tried looking at every related google result twice. I tried CIL build, refreshing elements etc. Nothing works.

Sometimes when I recompile the class I get "

Error executing code: FormStringControl (object), method Lookup called with invalid parameters.

Stack trace"

but then I compile it again and no errors.

I don’t know what the solution was but I tried it again today (with no changes) and it works fine. Just AX things.