StrangeLoopGames / EcoModKit

Eco Modkit
https://docs.play.eco
69 stars 25 forks source link

[9.5] Cannot attach debugger to release build server #40

Open MonzUn opened 2 years ago

MonzUn commented 2 years ago

This is a modding specific bug/issue so I figured it should go here rather than the main EcoIssues tracker.

If you attempt to attach a debugger using Visual Studio to a server downloaded from Play.Eco, it gives the following error

"Unable to attach to CoreCLR. A debug component is not installed.

This started happening with 9.4 (maybe 9.3?) and is quite an issue for anyone who doesn't have dev tier and therefore can't build a server that will accept a debugger.

Both me and Nid encountered this issue and I've had it reported by other modders trying to extend DiscordLink now as well.

The way we do our setups is to set the eco server exe file as the target file to run hitting Run in Visual Studio in our plugin library projects.

thetestgame commented 2 years ago

I remember this. I've been unable to reproduce it locally thus far. Attaching to a release server works when I try it. I'd need to know more details.

MonzUn commented 2 years ago

My guess is that you have something in your development environment that fixes it. I know it can be hard to get a clean test environment for reproducing these kind of things ^^' I'll get back to you with a premade setup for DiscordLink so that it's quick and easy for you to test.

To me, it seems like any DLL project that runs the server exe and tries to attach a debugger will fail, if it's a release build of the server and it has been packaged for release via your build script. A regular local release build does not trigger the issue so I'm guessing something that's required for debugging gets stripped when you run your build script.

JulianMa commented 2 years ago

Same exact Issue here. I can't attach the debugger to the EcoServer.exe.

On my Machine, this will occur every time, i try to attach. This can be reproduced by:

  1. Clean Visual Studio 22/ Visual Studio 19 Installation
  2. Create an empty Project
  3. Start EcoServer.exe
  4. Debug -> Attach to Process -> EcoServer.exe
  5. "Unable to attach the process. A debug component is not installed.

The error seen in the image below is slightly different from @MonzUn, however i'am getting the exact same error he does, when launching the Server via debug Configuration:

(launchSettings.json)

{
  "profiles": {
    "TitleModDebug": {
      "commandName": "Executable",
      "executablePath": "C:\\eco\\mods\\Eco\\Server\\EcoServer.exe",
      "workingDirectory": "C:\\eco\\mods\\TitleMod\\TitleMod\\bin\\Debug\\net5.0"
    }
  }
}

Version: 0.9.5.0-beta (https://play.eco/s3/release/EcoServerPC_v0.9.5.0-beta.zip) EcoServerPC_v0.9.5.0-beta.zip (SHA256): bc809c38e313f53581bd08c0b04227e3cd92e2af2f0463590c2b51f56f88c65c

Hopefully we can fix this.

image

redwyre commented 2 years ago

Have you guys tried with 9.6 develop/staging with .net 6?

MonzUn commented 2 years ago

I haven't, but I'll try it out when I start updating my mods for 9.6, probably in a week or two.

JulianMa commented 2 years ago

I will retry in the next few days

JulianMa commented 2 years ago

I tested it again: I can't attach to v0.9.5.4-beta, however it works without any problems in the current v0.9.6.0-beta-staging-2339 build. So i think we can close this one.

redwyre commented 2 years ago

excellent, closing

MonzUn commented 2 years ago

@redwyre This issue is back in the release version of 9.6. Can we reopen? @JulianMa ran into it again and here's someone else in your Discord having the same issue. https://discord.com/channels/254025510651297802/273246138835009548/1018300049022779462

MonzUn commented 1 year ago

This issue is still present in 9.7.6. I used a fresh dev environment on a laptop that just had the OS installed today, so there shouldn't be any pollution in the environment.

image

V0rag commented 1 year ago

Tested under 9.7.8, error still present. Quite bothersome, modding without debugging isnt very convenient.

MonzUn commented 8 months ago

Tested in Eco 10 in a fresh environment. Issue is still present.