Select to view content in your preferred language

CoreHost SpatialReference Issue

243
3
a month ago
GaryBilotta
Regular Contributor

I am working on my first CoreHost application and am running into issues deploying it.  The CoreHost application is a console application that I can debug and run successfully in Visual Studio 2022, and I can run it by hand outside of Visual Studio.  The issue is that this application will be run at night with other batch jobs, and when I attempt to have the scheduling software execute it, it fails- but it fails at an unexpected location. The code begins to execute and even opens a couple of feature classes, but when I try to do anything with spatial references, that is when it fails.  Both bits of code below fail.  If I were initializing incorrectly or didn't have the licensing configured properly, I would expect not to be able to open feature classes, but that part is successful.  I am running Pro 3.3.4.

SpatialReference pSRWebMerc_3857 = SpatialReferences.WebMercator;
or
SpatialReference pSRWebMercAuxSph84_3857 = null;
SpatialReferenceBuilder spatialReferenceBuilder = new SpatialReferenceBuilder(3857);
pSRWebMercAuxSph84_3857 = spatialReferenceBuilder.ToSpatialReference();

 

This is the error: 

CoreInterop
at CGeometryInterop.CreateSpatialReferenceFromID_(CGeometryInterop*, Int32 wkid, Int32 vWkid, ISpatialReference** ppSR)
at CGeometryInterop.CreateSpatialReferenceFromID(CGeometryInterop*, Int32 wkID, Int32 wkvID, Void** outHandle)
at ArcGIS.Core.Internal.ISpatialReferenceIOP.CreateSpatialReferenceFromID(Int32 wkID, Int32 wkvID)
at ArcGIS.Core.Geometry.SpatialReferenceBuilder..ctor(Int32 wkid, Int32 verticalWkid, Boolean validateThread)
at ArcGIS.Core.Geometry.SpatialReferenceBuilder..ctor(Int32 wkid)
at UpdateFeatureClass.PerformCoreHostTask(String[] args) in \Dev\Repos\UpdateFeatureClass\clsUpdate.cs

Thoughts anyone??

Thank you!!!

0 Kudos
3 Replies
RichardDaniels
MVP Regular Contributor
Doe your SYSTEM account running the job have access to 'in \Dev\Repos\UpdateFeatureClass\clsUpdate.cs'? these failures are usually permission related.
0 Kudos
GaryBilotta
Regular Contributor

Yeah, the SYSTEM account does have access.

Thank you.

0 Kudos
SelimDissem
Esri Contributor

Hi Gary,

Could you share how the Core and CoreHost DLLs are referenced in your solution?

Did you use the CoreHost template to get started?

What scheduling software are you using? Windows task scheduler or something else? Does it only fail when you run it through the scheduler or does it also fail when you run it interactively? If it only fails through the scheduler, could you share the parameters for the task, especially the Security options?

Sorry for the barrage of questions, trying to better understand your problem and the environment around it.

0 Kudos