microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
192 stars 6 forks source link

can't attach unity debugger #1039

Closed Cxibo closed 3 weeks ago

Cxibo commented 1 month ago

Type: Bug

just nothing happen when i enter the command. unity 2022 is running in debug mode.

Extension version: 1.0.0 VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z) OS version: Windows_NT x64 10.0.22631 Modes:

sailro commented 1 month ago

Hi @Cxibo , could you show us your .vscode/launch.json please?

When I enter the command

Which one? does it make a difference when using F5 or when using Attach Unity Debugger fron the command palette?

Thanks!

jbevain commented 1 month ago

@Cxibo also, please make sure to update to 1.0.1, and turn the logging on from your launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to Unity",
            "type": "vstuc",
            "request": "attach",
            "logFile": "${workspaceRoot}/debug.log"
        }
    ]
}

And let us know if there's any error in the log file?

isiki0710 commented 1 month ago

--> R (attach-2): {"type":"response","request_seq":2,"success":false,"command":"attach","message":"Failed to attach debugger to 127.0.0.1:56968","body":{},"seq":2} <-- C (disconnect-3): {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":3} Stopping due to fatal error: NullReferenceException: Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object. at SyntaxTree.VisualStudio.Unity.Debugger.UnityEngine.Detach() at Microsoft.VisualStudio.Unity.AD7DebugAdapter.HandleDisconnectRequest(DisconnectArguments arguments) at Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.DebugAdapterBase.HandleProtocolRequest(String requestType, Object requestArgs) at Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.DebugAdapterBase.OnProtocolRequestReceived(Object sender, RequestReceivedEventArgs e) at Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Protocol.DebugProtocol.OnRequestReceived(String command, IRequestResponder responder) at Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.DebugAdapterBase.HandleDisconnectRequestAsync(IRequestResponder1 responder) at Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.DebugAdapterBase.<InitializeProtocolClient>b__5_12(IRequestResponder1 r) at Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Protocol.RequestInfo`1.Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Protocol.IRequestInfo.InvokeHandler(DebugProtocol protocol, ProtocolRequest request, Object args) at Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Protocol.DebugProtocol.HandleIncomingRequest(String msg) at Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Protocol.DebugProtocol.HandleIncomingMessage(String msg) at Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Protocol.DebugProtocol.ProcessMessageBody() at Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Protocol.DebugProtocol.ReaderThreadProc()

sailro commented 1 month ago

@isiki0710 I just fixed the issue related to the exception you are showing in your log. But this is just a side effect. It shows us that the debugger is unable to connect to the 127.0.0.1:56968 endpoint. So very probably a firewall issue or something preventing us from connecting on your system.

jbevain commented 3 weeks ago

Closing as we haven't heard back. Feel free to re-open if you have more information. Thanks!