azuredatastudio: Table Designer Error - "An error occurred while initializing the table designer: Object reference not set to an instance of an object"

Hi there

I am for some reason unable to use the Table Designer, as keep getting an “An error occurred while initializing the table designer: Object reference not set to an instance of an object” error.

Full error details: at Microsoft.Data.Tools.Sql.DesignServices.TableDesigner.TableDesigner…ctor(String connectionString, String accessToken, String schemaName, String tableName, Boolean isNewTable) at Microsoft.SqlTools.ServiceLayer.TableDesigner.TableDesignerService.CreateTableDesigner(TableInfo tableInfo) in D:\a_work\1\s\src\Microsoft.SqlTools.ServiceLayer\TableDesigner\TableDesignerService.cs:line 1545 at Microsoft.SqlTools.ServiceLayer.TableDesigner.TableDesignerService.<>c__DisplayClass13_0.<<HandleInitializeTableDesignerRequest>b__0>d.MoveNext() in D:\a_work\1\s\src\Microsoft.SqlTools.ServiceLayer\TableDesigner\TableDesignerService.cs:line 87 — End of stack trace from previous location — at Microsoft.SqlTools.ServiceLayer.TableDesigner.TableDesignerService.<>c__DisplayClass12_0`1.<<HandleRequest>b__0>d.MoveNext() in D:\a_work\1\s\src\Microsoft.SqlTools.ServiceLayer\TableDesigner\TableDesignerService.cs:line 73

This seems to be happening regardless of whether I try and create a new table or edit an existing table using the Table Designer.

Version Info: Version: 1.39.1 (user setup) Commit: 7553f799e175f471b7590302dd65c997b838b29b Date: 2022-08-30T01:11:13.047Z VS Code: 1.62.0 Electron: 13.6.6 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19044

Apologies in advance if this has been raised already - I couldn’t find any duplicates when searching.

Many thanks

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 22 (11 by maintainers)

Most upvoted comments

I also had the error “An error occured while initializing the table designer: Failed to initialize the table model.” with the exact same Stack Trace.

The solution for me was that I didn’t have sufficient permission to create a new table. I only had db_datareader and db_datawriter but needed db_owner. After that, the error message disappeared and everything worked as expected.

at Microsoft.Data.Tools.Sql.DesignServices.TableDesigner.TableDesigner..ctor(String connectionString, String accessToken, String schemaName, String tableName, Boolean isNewTable, Int32 largeTableRowCount)
   at Microsoft.SqlTools.ServiceLayer.TableDesigner.TableDesignerService.CreateTableDesigner(TableInfo tableInfo) in D:\a\_work\1\s\src\Microsoft.SqlTools.ServiceLayer\TableDesigner\TableDesignerService.cs:line 1807
   at Microsoft.SqlTools.ServiceLayer.TableDesigner.TableDesignerService.<>c__DisplayClass18_0.<<HandleInitializeTableDesignerRequest>b__0>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.SqlTools.ServiceLayer\TableDesigner\TableDesignerService.cs:line 101
--- End of stack trace from previous location ---
   at Microsoft.SqlTools.ServiceLayer.TableDesigner.TableDesignerService.<>c__DisplayClass17_0`1.<<HandleRequest>b__0>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.SqlTools.ServiceLayer\TableDesigner\TableDesignerService.cs:line 87

I also encounter the same problem, after checking, it seems that Azure Data Studio failed to initialize the TableDesigner class.

Error Started: https://github.com/microsoft/sqltoolsservice/blob/e63f571a7b4d0b86cc84edbf10a930cd1602cd46/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/TableDesignerService.cs#L1807 Error Ended: https://github.com/microsoft/sqltoolsservice/blob/e63f571a7b4d0b86cc84edbf10a930cd1602cd46/src/Microsoft.SqlTools.ServiceLayer/TableDesigner/TableDesignerService.cs#L87

According to first line: at Microsoft.Data.Tools.Sql.DesignServices.TableDesigner.TableDesigner…ctor(String connectionString, String accessToken, String schemaName, String tableName, Boolean isNewTable, Int32 largeTableRowCount)

It seems that Int32 largeTableRowCount is not needed for the initilization.

It would be very helpful, if anyone could find the solution.

@Tao4free Is table designer loading failing consistently for you? Can you also share the version info? largeTableRowCount used to be an optional variable but we made some changes recently and it’s no longer used.

Hi there, I couldn‘t to use the Table Designer either.

截屏2023-02-07 12 52 10

Full error details:

at Microsoft.Data.Tools.Sql.DesignServices.TableDesigner.TableDesigner..ctor(String connectionString, String accessToken, String schemaName, String tableName, Boolean isNewTable, Int32 largeTableRowCount)
at Microsoft.SqlTools.ServiceLayer.TableDesigner.TableDesignerService.CreateTableDesigner(TableInfo tableInfo) in D:\a\_work\1\s\src\Microsoft.SqlTools.ServiceLayer\TableDesigner\TableDesignerService.cs:line 1800
at Microsoft.SqlTools.ServiceLayer.TableDesigner.TableDesignerService.<>c__DisplayClass18_0.<<HandleInitializeTableDesignerRequest>b__0>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.SqlTools.ServiceLayer\TableDesigner\TableDesignerService.cs:line 99
--- End of stack trace from previous location ---
at Microsoft.SqlTools.ServiceLayer.TableDesigner.TableDesignerService.<>c__DisplayClass17_0`1.<<HandleRequest>b__0>d.MoveNext() in D:\a\_work\1\s\src\Microsoft.SqlTools.ServiceLayer\TableDesigner\TableDesignerService.cs:line 85

Version Info:

Version: 1.41.1 Commit: 33dce95b152227c4f10f6251ab30690fe9895c0c Date: 2023-01-28T00:47:32.573Z VS Code: 1.67.0 Electron: 19.1.8 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin arm64 22.3.0

SQL Server Info:

Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Aug 22 2017 17:04:49 Copyright © 2017 Microsoft Corporation Express Edition (64-bit) on Windows Server 2019 Datacenter 10.0 <X64> (Build 17763: ) (Hypervisor)

Hi there @alanrenmsft.

Thanks again for getting back to me.

Unfortunately, I am unable to provide the information requested, as I am using ADS within a corporate environment and do not have the required permissions to access the billing information nor spec of the databases we use in any detail. I am aware that we are on an Enterprise Agreement if this helps. I appreciate this is not very helpful!

I have had one of my colleagues try the same process and he has been able to access the Table Designer; however it took a very long time to load. I have noticed that when I try and open the Table Designer twice, the first time I get the error message I have mentioned, but the second time, I just get a “loading designer” spinning wheel. Nothing happens.

Is this a known issue? I am sure I have seen this elsewhere!

Cheers