Last week the inevitable happened. I created a page in C/Side with an ID that I had already been used by an extension.
Microsoft is aware of this issue but does not want to prevent it from happening.
The problem is that at first everything seems to work. Your new C/Side page will run just fine. I only noticed it after a restart of the Service Tier because this actually does a check but you have to dive into the Windows Event log to find it.
Extension objects are stored in the NAV App Object Metadata table. You can write a SQL Trigger that checks if a record exists in that table with the same ID and Type. This should show a message like this.
The Trigger can look something like this:
USE [NAV] -- change DB Name here
IF EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[CheckExtensionObject]'))
DROP TRIGGER [dbo].[CheckExtensionObject]
CREATE TRIGGER [CheckExtensionObject] ON [dbo].[Object]
SET NOCOUNT ON
DECLARE @ins_count int
SELECT @ins_count = COUNT(*) FROM inserted
IF (@ins_count <> 0) --BEGIN
IF ((select count(*) from [inserted] inner join [dbo].[NAV App Object Metadata] obj
ON obj.[Object Type] = inserted.[Type] AND obj.[Object ID] = inserted.[ID]) <> 0)
RAISERROR('Object Already Exist as an Extension Object', 18, -1, '');
SET NOCOUNT OFF
With thanks to Jorg Stryk.