Search Unity

Bug Cannot attach Debugger with any IDE, No connection - target machine actively refused it 127.0.0.1

Discussion in 'Editor & General Support' started by Warmacha, Jul 18, 2022.

  1. Warmacha

    Warmacha

    Joined:
    Dec 13, 2015
    Posts:
    30
    Spent the last day and a half trying to connect the debugger with Unity, Tried multiple versions of Visual studios and JetBrains Rider, all with the same error "No connection could be made because the target machine actively refused it 127.0.0.1: (port)".
    I am not trying to connect it to any external device, no server or website. Just in editor on my development pc.

    Steps I have taken:
    -Tried multiple IDE's including VS 2019, VS 2022, VS Code, and Jetbrains Rider.
    -Updating my Unity engine to 2021.3.6f1
    -Restarting computer multiple times.
    -Turning off Firewall
    -Manually setting it to attach to different ports
    -Rolling back last Windows Update
    -Restarting router
    -Uninstalling VS completely and reinstalling
    -Uninstalling Unity and Unity Hub completely and reinstalling
    -Reinstalling the Unity debugger tools for VS
    -Deleting and regenerating Library
    -Deleting .vs folder, .sln file, OBJ folder and all the cprojects
    -Deleting all files regarding Unity and Unity Hub in appdata
    -Clicking the regenerate project files button in external tools settings.
    -Tried on a separate project

    At this point, It must be something with my computer but I can't find any idea's on what that could be since the debugger was working a few days ago. I'm on a windows 10 enterprise machine.

    Any suggestions at this point is greatly appreciated, at wits end here.
     
    Last edited: Jul 18, 2022
    sampenguin likes this.
  2. failmelon

    failmelon

    Joined:
    Apr 12, 2016
    Posts:
    1
    I had this problem with trying to attach debug and with hyperv/windows sandbox features enabled
     
    jamesnw and Armitage1982 like this.
  3. Warmacha

    Warmacha

    Joined:
    Dec 13, 2015
    Posts:
    30
    It ended up kinda just... fixing itself? Don't know how, gave it a few days and was able to debug again fine.
     
    Last edited: Nov 30, 2023
  4. Armitage1982

    Armitage1982

    Joined:
    Jul 26, 2012
    Posts:
    38
    This just happened to me today.

    I was quite happy that I managed to re-enable Hyper-V a week ago. A BSOD was appearing since the last Windows updates when the "Intel Virtualization Technology" option was enabled in my Asus UEFI BIOS.

    Except that Windows Sandbox never worked anymore since that Windows update, same thing with Docker, so Hyper-V services becomes a bit useless on my machine (while it worked before). Anyway, I much prefer my debugger.

    Note, it is not enough to stop the services, only disabling the parameter in the BIOS worked on my side.

    Thanks for the tip.
     
  5. jamesnw

    jamesnw

    Joined:
    Mar 23, 2013
    Posts:
    51
    I have this same issue. Hopefully it gets fixed soon, as I need HyperV working and still be able to debug. I don't even have a firewall enabled and I still have problems; just keep getting the error "No connection could be made because the target machine actively refused it 127.0.0.1:56636".
     
  6. Warmacha

    Warmacha

    Joined:
    Dec 13, 2015
    Posts:
    30
    If anyone comes across this thread with the same problem, What normally fixes it for me now is ctrl+shift+f9 or remove all breakpoints, restart IDE, restart editor, run debugger again and it should connect.
     
  7. iandrepe

    iandrepe

    Joined:
    Nov 15, 2019
    Posts:
    1
    I had the same problem, soved it in VS Debug > Attach Unity Debugger and try the processes until you find the correct one (in my case I had 3 it was the 2nd one). This happened after uptating Nvidea Driver Unity crashed