ArcGIS Server/Portal 10.5 (Including the ArcGIS Server 10.5 Service Publishing Patch) has drawing errors with the same feature class name in multiple schemas.
For example: Production & Test schemas:
Production schema with feature class name ALPHA.CITY_LIMITS and one field name AGENCY_CODE
Test schema with feature class name BETA.CITY_LIMITS and two filed names
The mxd with BETA draws fine, attribute table contents look fine, symbol category draws fine and publishes without errors.
But, the published map service REST end point of the BETA schema feature class does not show the correct attributes. Instead it shows the attributes of the ALPHA schema feature class including its geometry column name of LAYER.
The BETA feature class uses the newer geometry filed name of SHAPE
The ArcGIS Server logs have errors about: Cannot find a field named AGENCY_NAME and references the ALPHA.CITY_LIMITS feature class
The map service added to a new empty webmap will not draw
Simply renaming the BETA schema feature class from CITY_LIMITS to CITY_LIMITSCOPY
and publishing works great, shows the correct fields names in the REST endpoint and draws fine in the webmap.
This acts like a BUG where ArcGIS Server scans the geodatabase alphabetically by schema name to find the correct feature class instead of scanning for the fully qualified feature class name.
It finds ALPHA.CITY_LIMITS before BETA.CITY_LIMITS