Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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

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

  1. Warmacha


    Dec 13, 2015
    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 (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


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


    Dec 13, 2015
    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 at 1:16 AM
  4. Armitage1982


    Jul 26, 2012
    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


    Mar 23, 2013
    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".
  6. Warmacha


    Dec 13, 2015
    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.