ThinkGeo.com    |     Documentation    |     Premium Support

CreateTable fails for FileGeodatabase

Hi,

I am using MS Desktop 10.0. I can create a FileGeodatabase but I cannot create a table. Here is my code:

        Dim sGeoFileName As String = Utils.GetUserFolder
	FileGeoDatabaseFeatureLayer.CreateFileGeoDatabase(sGeoFileName + "Stands")

	Dim oColumns As New Collection(Of String)

	oColumns.Add("OrgKeyId")
	oColumns.Add("StandKey")
	oColumns.Add("StandNumber")

	FileGeoDatabaseFeatureSource.CreateTable(sGeoFileName + "Stands.gdb", "Stand", 
            WellKnownType.Polygon, oColumns)

Here is the stack trace:
System.Reflection.TargetInvocationException was unhandled
HResult=-2146232828
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at ThinkGeo.MapSuite.Layers.FileGeoDatabaseFeatureSource.CreateTable(String fileGeoDatabasePathName, String tableName, WellKnownType wellKnownType, IEnumerable1 columns) at WindowsApplication1.frmMain.btnLayers_Click(Object sender, EventArgs e) in C:\Users\ZipPa\Documents\Visual Studio 2015\Projects\MapSuite 10 Product Center\frmMain.vb:line 35 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at WindowsApplication1.My.MyApplication.Main(String[] Args) in :line 81 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: HResult=-2146233036 Message=The type initializer for 'FileGdbApiWrapper.Templates' threw an exception. Source=ThinkGeo.MapSuite.Wrappers.FileGeoDatabaseX64 TypeName=FileGdbApiWrapper.Templates StackTrace: at FileGdbApiWrapper.Templates.get_XmlTemplate() at FileGdbApiWrapper.FileGdbApiWrapper.CreateTable(String fileGeoDatabasePathName, String tableName, WellKnownType wellKnownType, IEnumerable1 columns)
InnerException:
HResult=-2147467261
Message=Value cannot be null.
Parameter name: stream
ParamName=stream
Source=mscorlib
StackTrace:
at System.IO.StreamReader…ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean leaveOpen)
at System.IO.StreamReader…ctor(Stream stream)
at FileGdbApiWrapper.Templates…cctor()
InnerException:

Any ideas?

Thanks!

Steve

Hi Steve,

I have reproduced this exception, our developer will work on that.

Any update I will let you know.

Regards,

Don

Hi Steve,

Our developer had fixed that, please update your package to this version: https://www.nuget.org/packages/ThinkGeo.MapSuite.Layers.FileGeoDatabase/11.0.0-beta009

Please let us know whether that works.

Regards,

Don

1 Like

Thanks Don, it’s working now.

Cheers,

Steve

Hi Setve,

I am glad to hear that works!

Regards,

Don