I created a feature layer in my ArcGIS Online organization. The URL looks like: https://services7.arcgis.com/<unique string>/arcgis/rest/services/Test_Feature_Layer/FeatureServer
If I sign out of the licensing portal in ArcGIS Pro and then run the code shown below with my URL, it will freeze at the constructor on line 9.
How can I avoid this frozen state?
public bool TestConnection(string url)
{
return RunMCTOnNonGUIThread(() =>
{
Geodatabase gdb = null;
try
{
var service = new ServiceConnectionProperties(new Uri(url));
gdb = new Geodatabase(service);
return true;
}
catch
{
return false;
}
finally
{
gdb?.Dispose();
}
});
}
private T RunMCTOnNonGUIThread<T>(Func<T> function)
=> Task.Run(() => QueuedTask.Run(function)).Result;