Table cannot be marked as removed if used by other table that also is marked as removed
Describe the bug In our extension we have obsoleted some tables by marking them as Removed. This results in compilation errors, because an obsoleted table is used as a parameter in another obsoleted table. The same issue occurs if the table is used as a parameter in a method in the same table.
For example: Table A has a method with a parameter that refers to Table B. Table A has a method with a parameter that refers to Table A (Can be solved by deleting the method, but this is not allowed when published on AppSource).
These examples result in the compilation error: Table '...' is removed. How can we solve this error?
To Reproduce I've added a demo project where this issue is illustrated. ObsoleteTest.zip
Expected behavior It should be allowed to mark the tables as removed
5. Versions:
- AL Language: 7.0.420929
- Business Central: W1 17.2
When refactoring, we try to remove / obsolete objects, but are restricted to put the definite 'ObsoleteState' to 'Removed', because the table / object is still referenced in either the current object (by a procedure, which cannot be deleted since it might break the 'public API'), either in another object that already has been obsoleted.
The pragma directive seems to work only for warnings and does not get us any further.
Expected behavior Can we expect the compiler not to raise (compilation) errors on objects that have the 'ObsoleteState = Removed'? Or can we remove / set procedures to internal on obsoleted objects?
Now that I think about it, what's the point of ObsoleteState = 'Removed'? Can't the procedures have 'Pending' state and then you can actually remove them (if that day ever comes)? It at least allows you to keep obsoleted stuff in the solution but exclude it via pragmas in development and include it in production so nothing breaks, right?
That's the whole point, the day I'd like to remove the tables is now :)
We've been doing some refactoring and don't support the obsoleted feature any longer. So if it states pending, one might think they can still use the functionality, where it has been deprecated in fact. We want to avoid developers from using the obsoleted tables if really removed. The new feature replaces the old, so we want to brute force adoption of the new framework.
I know we can work with feature flags, but supporting both framework next to each other is not an option here.
I'd think it's enough to mark something as 'Pending' and in the tag you can see when it was obsoleted. If it's eventually removed, the consumer gets an error if he's still using it, just like if you change the state to 'Removed'. So our tactic is marking stuff as Pending and eventually we'll be able to use a filter for the tags to see what's been pending for enough time so it can be actually removed from the code in major updates.
But I'm with you, the ability to actually remove stuff is a much needed feature to be able to get rid of noisy unused code.
Hi! Thank you for this detailed report about compilation errors when tables marked as Removed reference each other.
Since this was reported, there have been significant improvements to how the compiler and AppSourceCop handle obsolete/removed objects — including updates in BC 24 and 25 to support deleting obsolete removed tables, table extensions, and fields.
We're closing this as part of a cleanup of older issues. If you still encounter this specific scenario (removed table referencing another removed table) on a current version, please open a new issue with updated repro steps.
Thank you for helping us improve the AL developer experience!