GDB cannot be opened in arcmap when layer create faile

q1:

var path = "d:\\11112.gdb";
using (var dataset = Dataset.Create(path, Drivers.FileGdb))
 {
     using (var vectorLayer = dataset.CreateLayer("11"))
     {
    
     }
}

above code will get exception
Name of the FileGDB layer must start with Latin letter or underscore. Arg_ParamName_Name
so when we open GDB in arcmap, there should be an empty GDB, but when we open it , arcmap show
failed to connect to database

q2:

   var path = "d:\\11114.gdb";
   using (var dataset = Dataset.Create(path, Drivers.FileGdb))
   {
       using (var vectorLayer = dataset.CreateLayer("L22"))
       {
          
           {
               var constructFeature = vectorLayer.ConstructFeature();
               constructFeature.Geometry = new LineString(new[] { new Point(1, 1), new Point(2, 2) })
               {
                   HasM = false,
                   HasZ = false
               };

               vectorLayer.Add(constructFeature);
           }


           {
               var constructFeature = vectorLayer.ConstructFeature();
               constructFeature.Geometry =  new Point(1, 1) ;

               vectorLayer.Add(constructFeature);
           }
       }
   }

above get exception {"FileGDB does not allow geometries of different types into same layer."}
the GDB also can not open by Arcmap with error
failed to connect to database
The correct one here should be that there is a layer called L22 with one feature inside

Hi, @lsl

Thanks for your notes!
These exceptions are correct, the layer must start with latin letter and we do not support different types of geometries into same layer.
But when you get exceptions like q1 or q2, file GDB not close correctly.
Please avoid these exceptions and then Arcmap will open file as you expected.

I know these exceptions are correct, but they caused the GDB file to be corrupted and unable to function properly
The status of GDB should be the last successful operation

Current implementation make changes to GDB file on dispose. So we can make several actions and save it at once in file. It works this way to make better performance. But after exception all changes not save.

But after exception all changes not save ,when recovery, GDB should at least be able to open normally, but now it cannot be opened

Hi, @lsl

I tested your example above. GDB dataset is open normally. It is empty and has zero layers but aspose.gis can open it. We can even edit this dataset by add new layers.
So, i guess the problem is arcmap cannot open dataset which was created this way. But from our side it works fine.

Can this issue be solved? After all, end user open it in arcmap

Please just avoid exceptions and then Arcmap will open file normally