I have an ArcObjects application that is throwing the exception, Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) on the line from the below code, feat.Store(). feat is an implementation of ESRI.ArcGIS.Geodatabase.IFeature. Throughout debugging, the application successfully ran ArcObjects code until it hit that line.

IEnumFeatureClass fcs = GetFeatureClasses();
IFeatureClass fc;

while ((fc = fcs.Next()) != null)
    IField fld = GetField();

    IQueryFilter qf = new QueryFilterClass();
    qf.WhereClause = fld.Name + "=" + "SomeValue";        

    IFeatureCursor crs = fc.Search(qf, false);
    IFeature feat;

    while ((feat = crs.NextFeature()) != null)
        feat.set_Value(feat.Fields.FindField(fld.Name), "SomeIDNumber");

I have tried compiling and debugging on both an Any CPU and x86 platforms. I have also attempted registering the dll into which this code is compiling. I am unable to confirm if dll registration was successful or not. At this point, it looks like dll registration was unsuccessful. I have also attempted GAC installation of this dll, and I can confirm that installation into the GAC was unsuccessful. I have also considered uninstalling ArcObjects and ArcMap and reinstalling ArcMap and ArcObjects, but before I continue down this road, I want to ask a question.

Does anybody have ideas about what might be happening here?

1 Answer 1


ClassNotRegistered is a bad error message, and usually there is something else at play, here are things I would try. Since you have an IFeature object I'm pretty skeptical of actual installation issues.

  1. Make sure the WhereClause is valid. If the field is a string make sure the value is in single quotes, no quotes if numerical, etc.
  2. Make sure the value you are setting in set_Value is valid for the feature type.
  3. Try an Update cursor instead of Search+Store.
  4. Set EmbedInteropTypes for all ESRI assemblies to false
  5. Try putting the workspace in an edit session (IWorkspaceEdit)
  6. If you're creating a stand alone program and not an add-in, make sure you've appropriately checked out the license (though if you've opened a feature class this shouldn't be an issue).
  7. Cursor objects must be explicitly released when you're done with them (System.Runtime.InteropServices.Marshal.FinalReleaseComObject(crs). It isn't clear if the error is the very first time you hit this line or not, but this could be an issue if you are many feature classes into the loop.

There's also the possibility of the feature or the feature class itself being corrupt or just finicky in someway. Sometimes ArcMap can open these up just fine, but hitting them in .NET will cause errors. If that's the case make a new feature class and reproduce the feature to test on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.