I'm not able to reproduce the issue with the following services and code. What version of the API are you using? and what layer type?
In sample below, I am using FeatureLayer with the same SpatialReferences as you have. The reported FullExtent for each layer matches the map.
Envelope envelope = null;
MyMapView.LayerViewStateChanged += (s, e) =>
{
var error = e.LayerViewState.Error ?? e.Layer.LoadError;
if(error != null)
{
MessageBox.Show(error.Message, error.GetType().Name);
return;
}
if (e.Layer is FeatureLayer && e.LayerViewState.Status != LayerViewStatus.Loading && e.Layer.FullExtent != null && !e.Layer.FullExtent.IsEmpty)
{
var extent = e.Layer.FullExtent;
if (envelope == null)
envelope = extent;
else
{
envelope = GeometryEngine.Union(envelope, extent)?.Extent;
}
if (envelope != null)
{
System.Diagnostics.Debug.WriteLine(extent);
MyMapView.SetViewpoint(new Viewpoint(envelope));
}
}
};
var map = new Map(Basemap.CreateTopographic());
map.OperationalLayers.Add(new FeatureLayer(new Uri("http://zimas.lacity.org/arcgis/rest/services/B_ZONING/MapServer/0")) { Id = "2229" });
map.OperationalLayers.Add(new FeatureLayer(new Uri("https://gis-public.co.san-diego.ca.us/arcgis/rest/services/rov/sdvote_politicalbounds/MapServer/0")) { Id = "2230" });
MyMapView.Map = map;
You may be using service metadata, LayerInfo.Extent, which is not projected. Before you can perform a union of two extents, you must put them in the same projection. You can then use GeometryEngine.Project
var extent = (((FeatureLayer)e.Layer).FeatureTable as ArcGISFeatureTable)?.Extent;
if (envelope == null)
envelope = extent;
else if(!envelope.SpatialReference.IsEqual(extent.SpatialReference))
{
var projectedExtent = GeometryEngine.Project(extent, envelope.SpatialReference);
envelope = GeometryEngine.Union(envelope, projectedExtent)?.Extent;
}
else
{
envelope = GeometryEngine.Union(envelope, extent)?.Extent;
}
if (extent != null)
{
System.Diagnostics.Debug.WriteLine(extent);
MyMapView.SetViewpoint(new Viewpoint(envelope));
}