Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Crash on Go to Definition #1115

Open
chawyehsu opened this issue Mar 2, 2024 · 7 comments
Open

[Windows] Crash on Go to Definition #1115

chawyehsu opened this issue Mar 2, 2024 · 7 comments

Comments

@chawyehsu
Copy link

Build info

sourcekit-lsp from swift-DEVELOPMENT-SNAPSHOT-2024-02-29-a

Swift version 6.0-dev (LLVM 22782c4aa467921, Swift 69ef3add6656b49)
Target: x86_64-unknown-windows-msvc

Trace log

[Trace - 10:04:51 AM] Sending request 'textDocument/hover - (14)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld/Sources/main.swift"
    },
    "position": {
        "line": 2,
        "character": 7
    }
}


[org.swift.sourcekit-lsp:request-14] default 2024-03-02 18:04:51.427
Received request: textDocument/hover
{
  "position" : {
    "character" : 7,
    "line" : 2
  },
  "textDocument" : {
    "uri" : "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld/Sources/main.swift"
  }
}
---
[Trace - 10:04:51 AM] Sending notification '$/cancelRequest'.
Params: {
    "id": 14
}


[org.swift.sourcekit-lsp:request-14] default 2024-03-02 18:04:51.432
Succeeded (took 3.9997100830078125ms)
textDocument/hover
Optional<HoverResponse>
{
  "contents" : {
    "kind" : "markdown",
    "value" : "WinSDK"
  }
}
---
[Trace - 10:04:51 AM] Received response 'textDocument/hover - (14)' in 7ms.
Result: {
    "contents": {
        "value": "WinSDK",
        "kind": "markdown"
    }
}


[org.swift.sourcekit-lsp:default] error 2024-03-02 18:04:51.433
Cannot cancel request 14 because it hasn't been scheduled for execution yet
---
[org.swift.sourcekit-lsp:notification-3] default 2024-03-02 18:04:51.433
Received notification: $/cancelRequest
{
  "id" : 14
}
---
[Trace - 10:04:51 AM] Sending request 'textDocument/hover - (15)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld/Sources/main.swift"
    },
    "position": {
        "line": 2,
        "character": 8
    }
}


[org.swift.sourcekit-lsp:request-15] default 2024-03-02 18:04:51.591
Received request: textDocument/hover
{
  "position" : {
    "character" : 8,
    "line" : 2
  },
  "textDocument" : {
    "uri" : "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld/Sources/main.swift"
  }
}
---
[org.swift.sourcekit-lsp:request-15] default 2024-03-02 18:04:51.594
Succeeded (took 3.0002593994140625ms)
textDocument/hover
Optional<HoverResponse>
{
  "contents" : {
    "kind" : "markdown",
    "value" : "WinSDK"
  }
}
---
[Trace - 10:04:51 AM] Received response 'textDocument/hover - (15)' in 7ms.
Result: {
    "contents": {
        "value": "WinSDK",
        "kind": "markdown"
    }
}


[Trace - 10:04:55 AM] Sending request 'textDocument/codeAction - (16)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld/Sources/main.swift"
    },
    "range": {
        "start": {
            "line": 2,
            "character": 8
        },
        "end": {
            "line": 2,
            "character": 8
        }
    },
    "context": {
        "diagnostics": [],
        "triggerKind": 2
    }
}


[org.swift.sourcekit-lsp:request-16] default 2024-03-02 18:04:55.241
Received request: textDocument/codeAction
{
  "context" : {
    "diagnostics" : [

    ],
    "triggerKind" : 2
  },
  "range" : {
    "end" : {
      "character" : 8,
      "line" : 2
    },
    "start" : {
      "character" : 8,
      "line" : 2
    }
  },
  "textDocument" : {
    "uri" : "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld/Sources/main.swift"
  }
}
---
[org.swift.sourcekit-lsp:request-16] default 2024-03-02 18:04:55.247
Succeeded (took 6.000518798828125ms)
textDocument/codeAction
Optional<CodeActionRequestResponse>
[

]
---
[Trace - 10:04:55 AM] Received response 'textDocument/codeAction - (16)' in 9ms.
Result: []


[Trace - 10:04:57 AM] Sending request 'textDocument/documentHighlight - (17)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld/Sources/main.swift"
    },
    "position": {
        "line": 2,
        "character": 8
    }
}


[org.swift.sourcekit-lsp:request-17] default 2024-03-02 18:04:57.225
Received request: textDocument/documentHighlight
{
  "position" : {
    "character" : 8,
    "line" : 2
  },
  "textDocument" : {
    "uri" : "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld/Sources/main.swift"
  }
}
---
[Trace - 10:04:57 AM] Sending request 'textDocument/definition - (18)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld/Sources/main.swift"
    },
    "position": {
        "line": 2,
        "character": 8
    }
}


[org.swift.sourcekit-lsp:request-18] default 2024-03-02 18:04:57.228
Received request: textDocument/definition
{
  "position" : {
    "character" : 8,
    "line" : 2
  },
  "textDocument" : {
    "uri" : "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld/Sources/main.swift"
  }
}
---
[org.swift.sourcekit-lsp:request-17] default 2024-03-02 18:04:57.229
Succeeded (took 4.001617431640625ms)
textDocument/documentHighlight
Optional<Array<DocumentHighlight>>
[

]
---
[Trace - 10:04:57 AM] Received response 'textDocument/documentHighlight - (17)' in 4ms.
Result: []


PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Exception Code: 0xC00000FD
[Info  - 10:04:57 AM] Connection to server got closed. Server will restart.
true
[Trace - 10:04:57 AM] Sending request 'initialize - (0)'.
Params: {
    "processId": 33180,
    "clientInfo": {
        "name": "Visual Studio Code",
        "version": "1.87.0"
    },
    "locale": "en",
    "rootPath": "c:\\Users\\hanabi\\workspace\\playground\\swift-on-win\\helloworld",
    "rootUri": "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "textOnlyTransactional",
                "normalizesLineEndings": true,
                "changeAnnotationSupport": {
                    "groupsOnLabel": true
                }
            },
            "configuration": true,
            "didChangeWatchedFiles": {
                "dynamicRegistration": true,
                "relativePatternSupport": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "resolveSupport": {
                    "properties": [
                        "location.range"
                    ]
                }
            },
            "codeLens": {
                "refreshSupport": true
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "workspaceFolders": true,
            "foldingRange": {
                "refreshSupport": true
            },
            "semanticTokens": {
                "refreshSupport": true
            },
            "fileOperations": {
                "dynamicRegistration": true,
                "didCreate": true,
                "didRename": true,
                "didDelete": true,
                "willCreate": true,
                "willRename": true,
                "willDelete": true
            },
            "inlineValue": {
                "refreshSupport": true
            },
            "inlayHint": {
                "refreshSupport": true
            },
            "diagnostics": {
                "refreshSupport": true
            }
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true,
                "versionSupport": false,
                "tagSupport": {
                    "valueSet": [
                        1,
                        2
                    ]
                },
                "codeDescriptionSupport": true,
                "dataSupport": true
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true,
                    "tagSupport": {
                        "valueSet": [
                            1
                        ]
                    },
                    "insertReplaceSupport": true,
                    "resolveSupport": {
                        "properties": [
                            "documentation",
                            "detail",
                            "additionalTextEdits"
                        ]
                    },
                    "insertTextModeSupport": {
                        "valueSet": [
                            1,
                            2
                        ]
                    },
                    "labelDetailsSupport": true
                },
                "insertTextMode": 2,
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                },
                "completionList": {
                    "itemDefaults": [
                        "commitCharacters",
                        "editRange",
                        "insertTextFormat",
                        "insertTextMode",
                        "data"
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    },
                    "activeParameterSupport": true
                },
                "contextSupport": true
            },
            "definition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "references": {
                "dynamicRegistration": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "hierarchicalDocumentSymbolSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "labelSupport": true
            },
            "codeAction": {
                "dynamicRegistration": true,
                "isPreferredSupport": true,
                "disabledSupport": true,
                "dataSupport": true,
                "resolveSupport": {
                    "properties": [
                        "edit"
                    ]
                },
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                },
                "honorsChangeAnnotations": true
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true,
                "rangesSupport": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true,
                "prepareSupportDefaultBehavior": 1,
                "honorsChangeAnnotations": true
            },
            "documentLink": {
                "dynamicRegistration": true,
                "tooltipSupport": true
            },
            "typeDefinition": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "implementation": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true,
                "foldingRangeKind": {
                    "valueSet": [
                        "comment",
                        "imports",
                        "region"
                    ]
                },
                "foldingRange": {
                    "collapsedText": false
                }
            },
            "declaration": {
                "dynamicRegistration": true,
                "linkSupport": true
            },
            "selectionRange": {
                "dynamicRegistration": true
            },
            "callHierarchy": {
                "dynamicRegistration": true
            },
            "semanticTokens": {
                "dynamicRegistration": true,
                "tokenTypes": [
                    "namespace",
                    "type",
                    "class",
                    "enum",
                    "interface",
                    "struct",
                    "typeParameter",
                    "parameter",
                    "variable",
                    "property",
                    "enumMember",
                    "event",
                    "function",
                    "method",
                    "macro",
                    "keyword",
                    "modifier",
                    "comment",
                    "string",
                    "number",
                    "regexp",
                    "operator",
                    "decorator"
                ],
                "tokenModifiers": [
                    "declaration",
                    "definition",
                    "readonly",
                    "static",
                    "deprecated",
                    "abstract",
                    "async",
                    "modification",
                    "documentation",
                    "defaultLibrary"
                ],
                "formats": [
                    "relative"
                ],
                "requests": {
                    "range": true,
                    "full": {
                        "delta": true
                    }
                },
                "multilineTokenSupport": false,
                "overlappingTokenSupport": false,
                "serverCancelSupport": true,
                "augmentsSyntaxTokens": true
            },
            "linkedEditingRange": {
                "dynamicRegistration": true
            },
            "typeHierarchy": {
                "dynamicRegistration": true
            },
            "inlineValue": {
                "dynamicRegistration": true
            },
            "inlayHint": {
                "dynamicRegistration": true,
                "resolveSupport": {
                    "properties": [
                        "tooltip",
                        "textEdits",
                        "label.tooltip",
                        "label.location",
                        "label.command"
                    ]
                }
            },
            "diagnostic": {
                "dynamicRegistration": true,
                "relatedDocumentSupport": false
            }
        },
        "window": {
            "showMessage": {
                "messageActionItem": {
                    "additionalPropertiesSupport": true
                }
            },
            "showDocument": {
                "support": true
            },
            "workDoneProgress": true
        },
        "general": {
            "staleRequestSupport": {
                "cancel": true,
                "retryOnContentModified": [
                    "textDocument/semanticTokens/full",
                    "textDocument/semanticTokens/range",
                    "textDocument/semanticTokens/full/delta"
                ]
            },
            "regularExpressions": {
                "engine": "ECMAScript",
                "version": "ES2020"
            },
            "markdown": {
                "parser": "marked",
                "version": "1.1.0"
            },
            "positionEncodings": [
                "utf-16"
            ]
        },
        "notebookDocument": {
            "synchronization": {
                "dynamicRegistration": true,
                "executionSummarySupport": true
            }
        }
    },
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///c%3A/Users/hanabi/workspace/playground/swift-on-win/helloworld",
            "name": "helloworld"
        }
    ]
}


[Error - 10:04:57 AM] Server process exited with code 3221225477.
[org.swift.sourcekit-lsp:request-0] default 2024-03-02 18:04:58.446
Received request: initialize
...
@ahoppen
Copy link
Collaborator

ahoppen commented Mar 2, 2024

Tracked in Apple’s issue tracker as rdar://123944504

@ahoppen
Copy link
Collaborator

ahoppen commented Mar 4, 2024

@chawyehsu Can you reproduce the issue? If so, would it be possible for you to attach the project that reproduces the crash and instructions on how to reproduce it? Unfortunately the log doesn’t contain a stack trace so it’s not very actionable as-is.

@chawyehsu
Copy link
Author

chawyehsu commented Mar 5, 2024

@ahoppen Yes I can reproduce this 100% it's just a boilerplate project generated with swift package, here's the environment and steps I used:

env:
Windows: 10.0.19045 (latest Windows SDK installed)
Swift: swift-DEVELOPMENT-SNAPSHOT-2024-02-29-a-windows
Python: 3.9
vscode: 1.87.0 (swift extension installed)

steps:

  1. swift package init --type executable
  2. open the project with vscode, add import WinSDK to main.swift
  3. Right click WinSDK and click Go to Definition
  4. sourcekit-lsp crashed with PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Exception Code: 0xC00000FD and restarted

the log doesn’t contain a stack trace

I've enabled all the verbose mode that I found, how can I help to catch the stack trace?

P.S. I just found that when I do the same thing with import Foundation it works as expected and opened the Foundation.swiftinterface for me, but with WinSDK sourcekit-lsp crashes 100%.

@ahoppen
Copy link
Collaborator

ahoppen commented Mar 5, 2024

There’s a good chance the issue has been fixed by apple/swift#72009 and apple/swift#71959. Could you try if you still see the issue in swift-DEVELOPMENT-SNAPSHOT-2024-03-03-a?

@chawyehsu
Copy link
Author

Then I need to wait for the next Swift snapshot build for Windows, swift-DEVELOPMENT-SNAPSHOT-2024-02-29-a is the latest one available at the moment.

@chawyehsu
Copy link
Author

Just tested with Swift nightly build on thebrowsercompany/swift-build, still see the issue.

❯ swift --version
compnerd.org Swift version 6.0-dev (LLVM 0c7823cab15dec9, Swift e98186b62c7ee2a)
Target: x86_64-unknown-windows-msvc

built on commit e98186b62c7ee2a, should have contained PRs you mentioned.

@chawyehsu
Copy link
Author

Tested and confirmed the issue is still reproducible in the latest swift-5.10-RELEASE-windows10 release published at Mar 05.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants