Handling System.Runtime.InteropServices.COMException

874
3
11-01-2022 05:55 AM
ShanmugapriyaL1
New Contributor II

Hi,

I am new to this ArcObjects SDK development

I am trying to get the feature class name from the shapefile.

But it throws,

System.Runtime.InteropServices.COMException: 'Unspecified error

The element '{http://schemas.microsoft.com/windows/2005/02/color/WcsCommonProfileTypes}Text' is used but not declared in the DTD/Schema.

I can't find solution to resolve this.

I am attaching my code snippet and error message below.

It would be more helpful if anyone has solution for this.

 

I am using visual studio 2019 and ArcGIS 10.8

 

ShanmugapriyaL1_0-1667307361900.png

 

 

 

0 Kudos
3 Replies
BrentHoskisson
Occasional Contributor III

This is how I connect to a shapefile workspace:

public static IWorkspace OpenShapeFileWorkspace(string shapeFileDir)
{
IWorkspace ws;
IPropertySet pShpConn = new PropertySetClass();
pShpConn.SetProperty("DATABASE", shapeFileDir);
IWorkspaceFactory wsf = new ShapefileWorkspaceFactoryClass();
ws = wsf.Open(pShpConn, 0);
return ws;
}

0 Kudos
ShanmugapriyaL1
New Contributor II

Hi,

Thanks for your reply.

I tried your code, but it also throws the same exception.

Please help me out in this.

ShanmugapriyaL1_0-1667374114971.png

 

0 Kudos
BrentHoskisson
Occasional Contributor III

What is expected from http://schemas.microsoft.com/windows/2005/02/color/WcsCommonProfileTypes ?

On the surface it looks like the shapefile is corrupted.  There may be something in it that is unsupported.

I would test opening other simpler shape files to test this.

Brent

 

0 Kudos