Call to create a Spatial Reference Factory never returns

192
2
12-20-2021 09:45 AM
Trippetoe
Occasional Contributor III

Hi everyone. 

I am working on an application that depends on a old version of the Runtime engine. The app has been working great for many years, but in the hurly burly fallout from the log4j issues last week, the server that hosted the app had to be shut down and then redeployed from a previous backup.  Everything on the restored version of the hosting server works great EXCEPT this old Engine app.  I've isolated the lines of code where the application breaks: 

try
{
logger.DebugFormat("Instantiating a new spatial reference environment class.");
ISpatialReferenceFactory3 srFactory = new SpatialReferenceEnvironmentClass() as  ISpatialReferenceFactory3;
logger.DebugFormat("New spatial reference environment class instantiated.");
}
catch(Exception ex)
{
logger.ErrorFormat(ex.ToString());
}

The code/application never returns from the call to create the Spatial reference factory, i.e. the logger never records the message that the class was instantiated and the 'catch' block is never invoked.

Any ideas on what could be going on in the application?

 

0 Kudos
2 Replies
Trippetoe
Occasional Contributor III

I also tried to create the spatial reference factory with the approach below. It too noiselessly fails - that is, the method call is never returned and there is no error message raised (that i can find).

Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
System.Object obj = Activator.CreateInstance(factoryType);
var srFactory = obj as ISpatialReferenceFactory3;

0 Kudos
Trippetoe
Occasional Contributor III

After a bit more digging, it's not the call to the Spatial Reference Factory that bombs out; it's a prior call to create an IPoint - basically the first call/use of Esri.ArcGIS.Geometry within the app.  The behavior is the same though.  The call is made, and nothing is ever returned (at least not before a time-out occurs). Again, no error messages are thrown.  The second 'logging' call is never executed. A code snippet is below. 

Before the Geometry dll is invoked, the code successfully makes calls to other Esri dlls, e.g. RuntimeManager, License, LocationManager. So this seems to be particular to the Geometry dll. 

In my Visual Studio project, i've tried setting Esri dll references to "Embed Interop Types" and I've tried "Copy Local". Neither has an impact on the behavior.

logger.DebugFormat("\tCreating a new point inside WSPoint constructor.");
IPoint InPoint = new Point();
InPoint.PutCoords(Convert.ToDouble(lng), Convert.ToDouble(lat));
logger.DebugFormat("\tPoint was created inside WSPoint constructor.");

0 Kudos