microsoft / azuredatastudio

Azure Data Studio is a data management and development tool with connectivity to popular cloud and on-premises databases. Azure Data Studio supports Windows, macOS, and Linux, with immediate capability to connect to Azure SQL and SQL Server. Browse the extension library for more database support options including MySQL, PostgreSQL, and MongoDB.
https://learn.microsoft.com/sql/azure-data-studio
MIT License
7.5k stars 882 forks source link

Schema Compare Apply fails with an error #22957

Open tecodan opened 1 year ago

tecodan commented 1 year ago

Issue Type: Bug

After selecting 'Apply', the following error is produced: "Apply schema compare changes failed....Error: index and length must refer to a location within the string. (Parameter 'length')"

I'm using DB as source, and SQL Project as target. Error seems to occur on 'Change' actions, and specifically on SqlProcedure types.

After some testing, it seems this issue occurs when the Target (in my SQL Project) is ~66kb or larger, and the Source (Proc in the DB) could be any size.

Anything less than ~66kb is OK, anything greater than ~66kb results in an error.

Applying changes in an older version of the Schema Compare tool (< Nov 2022 version) had no problems with large Stored procs.

Extension version: 1.18.0 Azure Data Studio version: azuredatastudio 1.42.0 (22f384e569bc90d8b3231cc8c8cff99ea16c5052, 2023-03-17T18:15:48.982Z) OS version: Windows_NT x64 10.0.17763 Restricted Mode: No Preview Features: Enabled

System Info |Item|Value| |---|---| |CPUs|Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz (4 x 2793)| |GPU Status|2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off| |Load (avg)|undefined| |Memory (System)|16.00GB (1.66GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
tecodan commented 1 year ago

You can use the following large target proc as an example, but anything ~68kb or larger can be used to replicate the issue. target_proc_big.txt

tecodan commented 9 months ago

Hi, I have tried the Insiders release (1.47.0-insider) using the SQL Database Projects (v1.3.1) and Schema Compare (v1.21.0) extensions and the problem still exists.

Any ETA on the fix? This is an issue for us as we have a few large procs and it means we need to continue using a much older release and this is becoming a problem for us.

Some additional logging info (exthost.log) when this occurs (after selecting the Apply button):

23-09-18 15:55:37.9422880 pid:13356 tid:12 sqltools Verbose: 0 : Sending message of id[], of type[Event] and method[tasks/newtaskcreated]
23-09-18 15:55:37.9468910 pid:13356 tid:12 sqltools Verbose: 0 : Sending message of id[], of type[Event] and method[tasks/statuschanged]
23-09-18 15:55:37.9496461 pid:13356 tid:12 sqltools Verbose: 0 : Sending message of id[], of type[Event] and method[tasks/statuschanged]
23-09-18 15:55:37.9504138 pid:13356 tid:12 sqltools Verbose: 0 : Sending message of id[], of type[Event] and method[tasks/statuschanged]
23-09-18 15:55:38.0352090 pid:13356 tid:16 sqltools Error: 0 : Schema compare publish project changes operation  failed with exception Index and length must refer to a location within the string. (Parameter 'length')
23-09-18 15:55:38.0378010 pid:13356 tid:12 sqltools Verbose: 0 : Sending message of id[], of type[Event] and method[tasks/statuschanged]
23-09-18 15:55:38.0386179 pid:13356 tid:12 sqltools Verbose: 0 : Sending message of id[], of type[Event] and method[tasks/statuschanged]
23-09-18 15:55:38.0406389 pid:13356 tid:12 sqltools Verbose: 0 : Sending message of id[1456], of type[Response] and method[schemaCompare/publishProject]
23-09-18 15:55:38.0413372 pid:13356 tid:12 sqltools Verbose: 0 : Finished processing message with id[1456], of type[Request] and method[schemaCompare/publishProject]
SakshiS-harma commented 8 months ago

@tecodan I acknowledge the critical nature of this issue and its impact on your daily operations. We are working to prioritize and schedule this fix. Thank you!

aprilrains commented 5 months ago

Any update on this - I end up applying most of my changes manually to get around this issue.

ChrisPalmerNZ commented 4 months ago

I am also having this problem, with schema compare v1.21.0, is there a way to install a previous version of schema compare that works? I am using this on Windows with ADS 1.48.0. I have tried downgrading ADS to 1.47.1, but the problem remains.

My colleague is running ADS 1.47.0 and schema compare 1.21.0 on Linux, and he does not get the problem. Could it be related to underlying C libraries, with differences between Windows and Linux? Are any users reporting this using Linux?

tecodan commented 4 months ago

I have all but given up on this tool and have moved over to use the Schema Compare tool in the ever-bloated VS2022

sev-palmer commented 4 months ago

I have the same issue. Odd that it hasn't been resolved yet.