Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Exception from IDataset.get_Workspace().

$
0
0
Hello,
I have begun to work on a prototype of a plugin to ArcMap 10.1. It works on our computers and for some customers, but other customers get an exception.

Exception message:
Error HRESULT E_FAIL has been returned from a call to a COM component.
Top of call stack:
at ESRI.ArcGIS.Geodatabase.IDataset.get_Workspace()
The C# code that triggers the exception is probably

IDataLayer2 dataLayer = ...
IDataset dataset = dataLayer as IDataset;
try
{
if (dataset != null
&& dataset.Category == "Shapefile Feature Class"
&& dataset.Workspace.Type == esriWorkspaceType.esriFileSystemWorkspace)
{
...
}
}
catch (Exception e)
{
...
}

So, it seems that the call to dataset.Workspace.Type throws an exception. What could cause that?

I noticed that there is a boolean method I could have called,

if (dataset.Workspace.Exists())

but if I get an exception just by getting the Workspace, I assume that I would never reach the Exists() method.
And I don't see what non-existence means. Is it the same as "file not found"?

I would be grateful for any help.

Viewing all articles
Browse latest Browse all 1374

Trending Articles