microsoft / vscode-mssql

Visual Studio Code SQL Server extension.
Other
1.55k stars 458 forks source link

ArgumentOutOfRangeException in SQL Tools Service #1681

Open xsoheilalizadeh opened 4 years ago

xsoheilalizadeh commented 4 years ago

Issue Type: Bug

Exception

[Error - 2:17:16 PM] Request textDocument/definition failed.
  Message: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at Babel.ParserGenerator.MinimalList`1.get_Item(Int32 index)
   at Babel.ParserGenerator.ModifiedMinimalList`1.get_Item(Int32 index)
   at Microsoft.SqlServer.Management.SqlParser.Parser.TokenManager.GetToken(Int32 tokenNumber)
   at Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion.ScriptDocumentInfo.GetPeekDefinitionTokens(ScriptParseInfo scriptParseInfo, Int32 startLine, Int32 startColumn) in D:\a\1\s\src\Microsoft.SqlTools.ServiceLayer\LanguageServices\ScriptDocumentInfo.cs:line 158
   at Microsoft.SqlTools.ServiceLayer.LanguageServices.LanguageService.GetDefinition(TextDocumentPosition textDocumentPosition, ScriptFile scriptFile, ConnectionInfo connInfo) in D:\a\1\s\src\Microsoft.SqlTools.ServiceLayer\LanguageServices\LanguageService.cs:line 1343
   at Microsoft.SqlTools.ServiceLayer.LanguageServices.LanguageService.HandleDefinitionRequest(TextDocumentPosition textDocumentPosition, RequestContext`1 requestContext) in D:\a\1\s\src\Microsoft.SqlTools.ServiceLayer\LanguageServices\LanguageService.cs:line 515
  Code: 0 

SQL Script

select bus_order.PassengerName as bus_passanger,
    sale.PassengerName as sale_passanger
from BusOrder as bus_order
    JOIN [724SalesReportUTF8] sale on 1 = 1
where
    -- REPLACE(bus_order.PassengerName,' ','')  = REPLACE(sale.PassengerName,' ','')
    -- and 
    bus_order.Phone = sale.PhoneNumber
    --   and bus_order.Price = CAST(sale.CustomerPrice as bigint)
    and bus_order.DepartDate = sale.DepartureDate
    and bus_order.Status != 'Reserved'
    and bus_order.TicketNumber is null

-- UPDATE BusOrder
-- SET TicketNumber = CAST(sale.TicketNumber as bigint)
-- FROM BusOrder bus_order
--     JOIN [724SalesReportUTF8] sale on 1 = 1
-- where REPLACE(bus_order.PassengerName,' ','')  = REPLACE(sale.PassengerName,' ','')
--     and bus_order.Phone = sale.PhoneNumber
--     --   and bus_order.Price = CAST(sale.CustomerPrice as bigint)
--     and bus_order.DepartDate = sale.DepartureDate
--     and bus_order.Status != 'Reserved'
--     and bus_order.TicketNumber is null

Extension version: 1.9.0 VS Code version: Code - Insiders 1.46.0-insider (e88b8d32aa7233f6cb3665f6dae9fa78b1e8aafb, 2020-05-13T08:04:48.706Z) OS version: Windows_NT x64 10.0.18363

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2808)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.88GB (1.96GB free)| |Process Argv|--folder-uri file:///c%3A/Code/alibaba/Distinguish| |Screen Reader|no| |VM|0%|
xsoheilalizadeh commented 4 years ago

I think this issue should move to microsoft/sqltoolsservice, am I right? @abist

abist commented 4 years ago

@xsoheilalizadeh Yes, you're right that the issue is in sqltoolsservice, but since it affects this extension, we can keep it open here as well.

ay-azara commented 7 months ago

Just breathing some life into this. SQLToolsService stills shows this message as of vscode-mssql v1.22.1 in VSCode v1.87.2