I'm using ArcGIS 9.3.1 and trying to get the code to create a new feature class in an existing personal geodatabase to work but I am having no luck. When running in debug mode from within vb.net it will fail with the standard "LoaderLock" error where it tells you to not run managed code inside a DllMain.
Dim pGeomDefEdit As IGeometryDefEdit = CType(pGeomDef, IGeometryDefEdit)
With pGeomDefEdit
.GeometryType_2 = esriGeometryType.esriGeometryPolygon
Dim pSpatRefFact As ISpatialReferenceFactory2 = New ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment
Dim pGeoCoordSys As IGeographicCoordinateSystem = pSpatRefFact.CreateGeographicCoordinateSystem(ESRI .ArcGIS.Geometry.esriSRGeoCSType.esriSRGeoCS_WGS19 84)
.SpatialReference_2 = pGeoCoordSys
End With
Dim pFields As IFields = New Fields
Dim pFieldsEdit As IFieldsEdit
Dim pField As IField
Dim pfieldEdit As IFieldEdit
pFieldsEdit = pFields
pField = New Field
pfieldEdit = pField
With pfieldEdit
.Name_2 = "ObjectID"
.Type_2 = esriFieldType.esriFieldTypeOID
End With
pFieldsEdit.AddField(pField)
pFieldsEdit = pFields
pField = New Field
pfieldEdit = pField
With pfieldEdit
.Name_2 = "SHAPE"
.Type_2 = esriFieldType.esriFieldTypeGeometry
.GeometryDef_2 = pGeomDef
End With
pFieldsEdit.AddField(pField)
Dim pWorkSpaceFactory As IWorkspaceFactory = New ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactory
Dim pFWS As IFeatureWorkspace = pWorkSpaceFactory.OpenFromFile("c:\Dan\Data\DataFi tness-1AOI.mdb", 0)
Dim pFeatClass As IFeatureClass
Dim pUID As New ESRI.ArcGIS.esriSystem.UID
pUID.Value = "esriGeoDatabase.Feature"
'FAILING HERE
pFeatClass = pFWS.CreateFeatureClass("TestFC1", pFieldsEdit, pUID, Nothing, esriFeatureType.esriFTSimple, "SHAPE", "") ```