Sure. It's really simple. I'm surprised it hasn't come up many times earlier.
You will naturally have to find a feature service that will take more than 3 minutes to respond.
private static void reproduceIsuse(string user, string pass)
{
Uri PortalUri = new Uri("https://servername.com/portal");
Uri FederatedFeatureServiceUri = new Uri("https://servername.com/server/rest/services/UNupdater/DeltaService/FeatureServer");
//License
ArcGIS.Core.Hosting.Host.Initialize();
//Portal
string referer, token;
if (!ArcGISSignOn.Instance.IsSignedOn(PortalUri))
ArcGISSignOn.Instance.SignInWithCredentials(PortalUri, user, pass, out referer, out token);
//Feture Service
ServiceConnectionProperties federatedArcGISServer = new ServiceConnectionProperties(FederatedFeatureServiceUri);
Geodatabase Geodatabase = new Geodatabase(federatedArcGISServer);
//Feature Layer
FeatureClass federatedServiceFeatureClass = Geodatabase.OpenDataset<FeatureClass>("L3Electric_network_Line");
//Reproduce Issue
DateTime timeBeforeSearch = DateTime.Now;
try
{
federatedServiceFeatureClass.Search(null, false); //Crash after 3 minutes
}
catch (GeodatabaseGeneralException gdbGeneralException)
{
var timeSpan = DateTime.Now.Subtract(timeBeforeSearch);
Console.WriteLine("Exception raised after: " + timeSpan.Minutes + " minutes " + timeSpan.Seconds + " seconds");
}
}
Just in case it matters, we are using Portal for ArcGIS 10.9.1 and ArcGIS Web Adapter (IIS) 10.9.1. And on our clients executing the CoreHost application we have ArcGIS Pro 2.9.1.