Exception from HRESULT: 0x8004150D

638
1
02-07-2011 10:09 AM
AleksandrasKapitanovas
New Contributor
Hi,
For some time I`m keep getting an ugly error from ArcObjects 10 that I can not figure out. From my point of view the code below does not have anything wrong with it:
IWorkspaceFactory2 workspaceFactory = new SdeWorkspaceFactory() as IWorkspaceFactory2;
            IWorkspace workspace = workspaceFactory.OpenFromString("connection to sql server", 0);
            IFeatureClass featureClass0 = ((IFeatureWorkspace)workspace).OpenFeatureClass("TABLE0");
            IFeatureClass featureClass1 = ((IFeatureWorkspace)workspace).OpenFeatureClass("TABLE1");
            IFeatureClass featureClass2 = ((IFeatureWorkspace)workspace).OpenFeatureClass("TABLE2");
            IQueryFilter2 filter = new QueryFilterClass();
            ISpatialFilter geometryFilter = new SpatialFilterClass();
            IFeature selectedStateForest = null;

            filter.WhereClause = "mu_kod = 11";

            selectedStateForest = featureClass0.Search(filter, true).NextFeature();

            geometryFilter.Geometry = selectedStateForest.Shape;
            geometryFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;

            try
            {
                do
                {
                    IFeatureCursor iter = featureClass1.Search(geometryFilter, true);
                    IFeature tmp = null;
                    int count1 = -1, count2 = -1;

                    do
                    {
                        tmp = iter.NextFeature();

                        count1++;
                    } while (tmp != null);

                    iter = featureClass2.Search(geometryFilter, true);
                    do
                    {
                        tmp = iter.NextFeature();

                        count2++;
                    } while (tmp != null);
                } while (true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Whoops");
            }

In this example I`m doing simple counting for error reproduction. It seems that sometimes error is like in post title and sometimes it`s just HRESULT E_FAIL. Application runs for about minute returning correct results and then simply fails. Any help would be appreciated.
0 Kudos
1 Reply
ErinBrimhall
Occasional Contributor II
Hi,
For some time I`m keep getting an ugly error from ArcObjects 10 that I can not figure out. From my point of view the code below does not have anything wrong with it:
IWorkspaceFactory2 workspaceFactory = new SdeWorkspaceFactory() as IWorkspaceFactory2;
            IWorkspace workspace = workspaceFactory.OpenFromString("connection to sql server", 0);
            IFeatureClass featureClass0 = ((IFeatureWorkspace)workspace).OpenFeatureClass("TABLE0");
            IFeatureClass featureClass1 = ((IFeatureWorkspace)workspace).OpenFeatureClass("TABLE1");
            IFeatureClass featureClass2 = ((IFeatureWorkspace)workspace).OpenFeatureClass("TABLE2");
            IQueryFilter2 filter = new QueryFilterClass();
            ISpatialFilter geometryFilter = new SpatialFilterClass();
            IFeature selectedStateForest = null;

            filter.WhereClause = "mu_kod = 11";

            selectedStateForest = featureClass0.Search(filter, true).NextFeature();

            geometryFilter.Geometry = selectedStateForest.Shape;
            geometryFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;

            try
            {
                do
                {
                    IFeatureCursor iter = featureClass1.Search(geometryFilter, true);
                    IFeature tmp = null;
                    int count1 = -1, count2 = -1;

                    do
                    {
                        tmp = iter.NextFeature();

                        count1++;
                    } while (tmp != null);

                    iter = featureClass2.Search(geometryFilter, true);
                    do
                    {
                        tmp = iter.NextFeature();

                        count2++;
                    } while (tmp != null);
                } while (true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Whoops");
            }

In this example I`m doing simple counting for error reproduction. It seems that sometimes error is like in post title and sometimes it`s just HRESULT E_FAIL. Application runs for about minute returning correct results and then simply fails. Any help would be appreciated.


Hi Valdas,

Some searching indicates that the HRESULT error code you're seeing translates to: "FDO_E_SE_OUT_OF_SVMEM - ESRI.ArcGIS.Geodatabase.fdoError"

This "server out of memory" error is likely caused by your outer-most while-loop, whose conditional is simply "true", which will essentially give you an infinite loop.  If you actually need this kind of "polling" functionality where you constantly query the two feature classes, you might consider a using-clause in conjunction with ComReleaser to ensure the memory allocated to your objects is properly freed after each iteration of your while-loop.

Check out this thread for more info on ComReleaser and how to use it.

Hope that helps.
0 Kudos