godot-csharp-visualstudio icon indicating copy to clipboard operation
godot-csharp-visualstudio copied to clipboard

Latest Update from the submitted PRs

Open GeorgeS2019 opened this issue 3 years ago • 33 comments

There have been THREE PRs recently

  • https://github.com/godotengine/godot-csharp-visualstudio/pull/31
  • https://github.com/godotengine/godot-csharp-visualstudio/pull/32
  • https://github.com/godotengine/godot-csharp-visualstudio/pull/35

Please provide the following information

  • Are these PRs work for VS2022 or Just VS2019. Suggestion: please include VS2022
  • What environment have people tested these PRs. Godot3 or Godot4 and what version. What is your experience?

I am interested to know if these PRs work with Godot4 with dotnet6 merged

GeorgeS2019 avatar Aug 31 '22 13:08 GeorgeS2019

It works bro it is locked to 2022....

Intrivus avatar Aug 31 '22 15:08 Intrivus

I compiled the plugin xd

Intrivus avatar Aug 31 '22 15:08 Intrivus

I saw under VS2019 menu extension. The submenu..GoDot and configure...but it crashes..

Share screenshots..please

GeorgeS2019 avatar Aug 31 '22 15:08 GeorgeS2019

i can send u the compiled plugin? and i fixed the GoDot bug replaced with Godot

Intrivus avatar Aug 31 '22 15:08 Intrivus

Yes..please share ..do u use Google drive to share

GeorgeS2019 avatar Aug 31 '22 15:08 GeorgeS2019

image The extension: https://www.mediafire.com/file/24ch2tz6u6embbq/GodotAddinVS.vsix/file

Intrivus avatar Aug 31 '22 15:08 Intrivus

Btw u should help me by telling the owner of the PR to make some changes i mention in the PR of his/her

Intrivus avatar Aug 31 '22 15:08 Intrivus

who are you

Intrivus avatar Aug 31 '22 15:08 Intrivus

If this works, i will promote through godot discord

Dont promote me, promote the guy who make these changes

Intrivus avatar Aug 31 '22 15:08 Intrivus

@GeorgeS2019 does it work?

Intrivus avatar Aug 31 '22 15:08 Intrivus

@PandoCyclone

I installed the extension to VS2022. I see the Godot submenu under the Extension Top menu

I provide the Godot exe path to the the Godot Configure submenu

Then I launch Godot (Click)

The Godot exe specified during configure started and run the scene file (chosen)

====> However, the editor did not stop at the BREAKPOINT!!

GeorgeS2019 avatar Aug 31 '22 16:08 GeorgeS2019

My VS2022 17.4 preview

Not sure if this is related to this bug Extension stopped working on VisualStudio v17.3.0

GeorgeS2019 avatar Aug 31 '22 16:08 GeorgeS2019

So it worked or not xd? And i think the breakpoint part is a bug from the extension itself

Intrivus avatar Aug 31 '22 16:08 Intrivus

btw check this out to be 100% sure https://github.com/jiiks/godot-csharp-visualstudio

Intrivus avatar Aug 31 '22 16:08 Intrivus

Just so we are on the same page.

There is no more Play in Editor button There is no more extra steps we need to do a few months back

Now, we define the godot exe path and Luanch Godot.

GeorgeS2019 avatar Aug 31 '22 16:08 GeorgeS2019

Just so we are on the same page.

There is no more Play in Editor button There is no more extra steps we need to do a few months back

Now, we define the godot exe path and Luanch Godot.

Yes but there is some problem as i mentioned here https://github.com/godotengine/godot-csharp-visualstudio/pull/32#issuecomment-1232433130 which should make it even better

Intrivus avatar Aug 31 '22 16:08 Intrivus

By making icon for the button and make the button replaced with the Debug one or at least in the tool bar

Intrivus avatar Aug 31 '22 16:08 Intrivus

I suggest U do a gif animated showing that it debug and stop at BreakPoints

GeorgeS2019 avatar Aug 31 '22 16:08 GeorgeS2019

I suggest U do a gif animated showing that it debug and stop at BreakPoints

The breakpoints bug is from the plugin itself not because this PR

Intrivus avatar Aug 31 '22 16:08 Intrivus

Is the breakpoints bug VS2022 version dependence?

If yes, showing that it works now with other version of VS2022 will also help a lot. We need the breakpoints <=== to work

GeorgeS2019 avatar Aug 31 '22 16:08 GeorgeS2019

I will be away. Thanks for the effort of sharing. I compile https://github.com/jiiks/godot-csharp-visualstudio

Godot run from VS2022 but NOT breakpoint This version is GoDot and not Godot

GeorgeS2019 avatar Aug 31 '22 16:08 GeorgeS2019

For me I don't even know what breakpoints are but you can ask everyone or just watch youtube videos they show that breakpoints bug not work and some workaround for that too. Here is a video for example: https://www.youtube.com/watch?v=lOjOb4Lv_ww&list=WL&index=2&t=992s&ab_channel=FinePointCGI

Intrivus avatar Aug 31 '22 16:08 Intrivus

I will be away. Thanks for the effort of sharing. I compile https://github.com/jiiks/godot-csharp-visualstudio

Godot run from VS2022 but NOT breakpoint This version is GoDot and not Godot

Try my fix i sent upthere which fix the bug showing GoDot replaced with Godot and other enhance please check this https://github.com/godotengine/godot-csharp-visualstudio/pull/32#issuecomment-1232433130 comment and support for better PR

Intrivus avatar Aug 31 '22 16:08 Intrivus

The old version, a few months back, the breakpoint WORKs BUT extra steps just to make it works

https://www.youtube.com/watch?v=lOjOb4Lv_ww&list=WL&index=2&t=992s&ab_channel=FinePointCGI

YES, this was the old way and I was able to make breakpoint work. ==> BUT it is NOT reliable.

GeorgeS2019 avatar Aug 31 '22 16:08 GeorgeS2019

I assume this is @Jiiks 's plan

From @neikeq: Better IDE support by default, less features need to be implemented in Godot IDE extensions. Projects would be runnable by default as they would be executable rather than library C# projects. A Godot extension would only need to add the more fancy features like Play in Editor.

Summary

Debug targets

  • Play in Editor
    Launches the game in the Godot editor for debugging in Visual Studio.
    For this option to work, a running Godot instance must be editing the project.
  • Launch
    Launches the game with a Godot executable for debugging in Visual Studio.
    Before using this option, the value of the "executable" property must be changed to a path that points to the Godot executable that will be launched.
  • Attach
    Attaches to a running Godot instance that was configured to listen for a debugger connection.

GeorgeS2019 avatar Sep 01 '22 01:09 GeorgeS2019

Information provided by Neikeq how to get the extension to work with Godot4

Side note, think I've asked this before maybe, do you know of any way to attach a C# debugger to the C# module code in godot on Linux? To be able to set breakpoints in the modules/mono .cs files, run the editor and step through things? I feel like the answer is no, it seems to be possible on Windows with VS but no Linux tool I've tried is capable of the same "mixed mode" debugging magic that MS have.

I don't know about mixed mode, but for C# only I can do this in Rider:

  • Add New Cofiguration: .NET Executable
    • Exe path: Path to Godot executable
    • Program arguments: --path /path/to/godot/project/
    • Runtime: .NET / .NET Core

I tried this with VSCode, but I don't remember if it worked:

{
    "name": ".NET Core Launch (console)",
    "type": "coreclr",
    "request": "launch",
    "program": "Path to Godot executable",
    "args": ["--path", "/path/to/godot/project/"],
    "stopAtEntry": false,
    "console": "internalConsole"
}

As for Windows and Visual Studio, you must add the following to your csproj (or a Directory.Build.props):

  <PropertyGroup>
    <StartAction>Program</StartAction>
    <StartProgram>C:\Path\To\Godot.exe</StartProgram>
    <StartArguments>--path C:\Path\To\Godot\Project\</StartArguments>
  </PropertyGroup>

GeorgeS2019 avatar Sep 01 '22 16:09 GeorgeS2019

From neikeq: The root of the issue applies to Godot 4 as well. However, there are other challenges as well, like how to implement Play in Editor with the CoreCLR debugger.

Debugging CoreCLR

"To debug this project, configure it to use the 'Managed (CoreCLR)' debugger." when trying to debug multi target framework in .NET Core

Visual Studio managed debugger

How to: Specify Debugger Settings

GeorgeS2019 avatar Sep 01 '22 20:09 GeorgeS2019

case ExecutionType.Launch:

var processStartInfo = new ProcessStartInfo(GetGodotExecutablePath())
{
    string workingDir = startInfo.WorkingDirectory;

    Arguments = $"--path {workingDir} --remote-debug {host}:{remoteDebugPort} {godotStartInfo.StartArguments}", // TODO: Doesn't work with 4.0dev. Should be tcp://host:port which doesn't work in 3.2...
    WorkingDirectory = workingDir,
    RedirectStandardOutput = true,
    RedirectStandardError = true,
    UseShellExecute = false,
    CreateNoWindow = true
};

case ExecutionType.PlayInEditor:

var godotMessagingClient = GodotPackage.Instance.GodotSolutionEventsListener?.GodotMessagingClient;

// TODO: Read the editor player stdout and stderr somehow

case ExecutionType.Attach:

_attached = true;
StartConnecting(godotStartInfo);

GeorgeS2019 avatar Sep 04 '22 11:09 GeorgeS2019

Command line options

Command line options that can be included in godotStartInfo.StartArguments

Debug options

Standalone tools

Running a specific Scene :

Feature Request: 'Play Scene' from Visual Studio

Debugging a specific Scene

Running/Debugging a specific script

GeorgeS2019 avatar Sep 04 '22 12:09 GeorgeS2019

Umm, so there is a way to change GoDot to Godot But I need help with how to open a PR

Intrivus avatar Sep 04 '22 15:09 Intrivus