Select to view content in your preferred language

GPUtilities Class Problem

955
3
09-05-2013 01:07 PM
BruceNielsen
Frequent Contributor
I'm trying to use a call to the GPUtilities class 3 times in 2 modules in the VB.NET addin I'm developing (ArcGIS 10.0, VS 2010). Since it is a singleton object, each time it is declared with:
Dim t As Type = Type.GetTypeFromProgID("esriGeoprocessing.GPUtilities")
Dim obj As System.Object = Activator.CreateInstance(t)
Dim pGPU As ESRI.ArcGIS.Geoprocessing.IGPUtilities3 = obj

It is working for the first 2 occurrances in the first module, but when the code gets to the third occurrance in the second module
Dim pHELLayer As IFeatureLayer = pGPU.OpenFeatureLayerFromString("F:\SD_Tools\HEL_Tool\HEL_Data.shp")
I get this message:
[ATTACH=CONFIG]27240[/ATTACH]
Any ideas on how to fix this error? Do I need to go back to using a WorkspaceFactory to access this shapefile?
0 Kudos
3 Replies
DuncanHornby
MVP Notable Contributor
Bruce,

Not come across that error before but as I interpret it, it is saying that pHELLayer exists already. Have you opened it in the other module you refer to? May be using the ReleaseInternals method on IGPUtilities may help?

Duncan
0 Kudos
BruceNielsen
Frequent Contributor
Bruce,

Not come across that error before but as I interpret it, it is saying that pHELLayer exists already. Have you opened it in the other module you refer to? May be using the ReleaseInternals method on IGPUtilities may help?

Duncan

No, I hadn't used that variable in any other place. I was actually using the OpenFeatureLayerFromString method directly as a parameter in a function, and got the same error. I took it out and assigned it to pHELLayer in order to isolate what was causing the error.

I will try ReleaseInternals to see if that helps.

Thanks.
0 Kudos
BruceNielsen
Frequent Contributor
I'm reviving this thread because I was bit by the same issue again today. After a Google search (why didn't I think of that last time?), I found a solution by Ken Buja from 2008 in the archived forums (http://forums.esri.com/Thread.asp?c=93&f=1170&t=248305).

So Ken, if you reply to this thread I'll give you credit for the solution. Thanks for answering my 2 month old question 5 years ago.
0 Kudos