ArcObjects C# Randomly fails to open workspace

2049
1
11-12-2013 04:13 AM
MathieuVILLEMONT1
Occasional Contributor
Hello,

My program randomly fails to open a workspace: System.Runtime.InteropServices.COMException (0x80040213): Exception de HRESULT : 0x80040213

IWorkspaceFactory workspaceFactory = new AccessWorkspaceFactoryClass();
pFWksSource = (IFeatureWorkspace)workspaceFactory.Open(propertySet, 0);


I have tried a workaround (as suggested in another post) by retrying when it fails with error code -2147220973. It seemed to work for a while but I still sometime exceed the number of retry (3).

Any suggestions on how to fix that ?

BR
0 Kudos
1 Reply
NeilClemmons
Regular Contributor III
You should not be using the New keyword to create instances of singleton objects such as workspaces.  Use the Activator class instead.

http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Interacting_with_singleton_objec...
0 Kudos