SWY1985 / CivOne

An open source implementation of Sid Meier's Civilization.
http://www.civone.org/
Creative Commons Zero v1.0 Universal
244 stars 49 forks source link

Can't debug in Visual Studio Code #348

Open AlexFolland opened 7 years ago

AlexFolland commented 7 years ago

This is mattering more, so I'm reporting it as an issue in case you have any suggestions. Here is the debug console output when I try to "Start Debugging" in Visual Studio Code.

-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Private.CoreLib.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'e:\games\civone\bin\Debug\netcoreapp1.1\CivOne.dll'. Symbols loaded.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\mscorlib.dll'. Cannot find or open the PDB file.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Console.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Users\Alex\.nuget\packages\OpenTK.NETCore\1.1.2571.6431\lib\netstandard1.3\OpenTK.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.IO.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.IO.FileSystem.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Text.Encoding.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Text.Encoding.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Threading.Tasks.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Game Start
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Collections.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.IO.FileSystem.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Runtime.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Runtime.InteropServices.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Runtime.Handles.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Setting Loaded - FullScreen: 0
Setting Loaded - Scale: 4
Setting Loaded - AspectRatio: 0
Setting Loaded - DebugMenu: 1
Setting Loaded - CursorType: 0
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.0\System.Runtime.InteropServices.RuntimeInformation.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[13332] CivOne.dll' has exited with code 1080890248 (0x406d1388).
SWY1985 commented 7 years ago

I'll install Windows 7 in a VMware machine today and see if I can reproduce this.

SWY1985 commented 7 years ago

If it's no problem for you, can you uninstall the .NET Core SDK and install this older version: https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.1-preview2.1-download.md

This could be a temporary solution to the debugging problems.

AlexFolland commented 7 years ago

I will try it.

AlexFolland commented 7 years ago

Actually, that is the version I already have installed. It was the latest version on their site as of 2017-03-01 when I installed it. Where is a more recent version?

AlexFolland commented 7 years ago

I'm trying this one now: https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.1.1-download.md

AlexFolland commented 7 years ago

Same thing, but with the higher version number:

-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Private.CoreLib.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'e:\games\civone\bin\Debug\netcoreapp1.1\CivOne.dll'. Symbols loaded.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\mscorlib.dll'. Cannot find or open the PDB file.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Console.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Users\Alex\.nuget\packages\OpenTK.NETCore\1.1.2571.6431\lib\netstandard1.3\OpenTK.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.IO.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.IO.FileSystem.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Text.Encoding.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Text.Encoding.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Threading.Tasks.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Game Start
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Collections.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.IO.FileSystem.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Runtime.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Runtime.InteropServices.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Runtime.Handles.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Setting Loaded - FullScreen: 0
Setting Loaded - Scale: 4
Setting Loaded - AspectRatio: 0
Setting Loaded - DebugMenu: 1
Setting Loaded - CursorType: 0
Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1\System.Runtime.InteropServices.RuntimeInformation.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[14560] CivOne.dll' has exited with code 1080890248 (0x406d1388).
AlexFolland commented 7 years ago

Why is it compiling a dll instead of an exe? How did you build an exe release before? The debugger not attaching may be because the equivalent of "Just My Code" is enabled. Perhaps that can be disabled, allowing debugging of dll files. This is an uneducated guess though. Googling this did not give me any useful results.

SWY1985 commented 7 years ago

The reason .NET Core compiles to .dll instead of .exe is that by default it requires the .NET Core runtime to run. It's possible to publish the game in a way that it runs stand-alone.

To publish/compile to .exe, you need to remove the following line from the project.json: "type": "platform",

Then, open a command prompt to the CivOne root folder and type: dotnet publish -c release -r win7-x64

It will create an .exe file under ~/bin/release/netcoreapp1.1/win7-x64/publish

This whole process will become a lot easier soon... but .NET Core is still in development and things change all the time. I'm going to migrate the project from project.json to .csproj soon, and I'm going to provide scripts/batch files that help with the compilation/publishing process.

SWY1985 commented 7 years ago

It's strange, I had a fresh Windows 7 install and everything worked the first time, including debugging.

AlexFolland commented 7 years ago

I installed that version. I built the exe. That worked well. It's just debugging that doesn't work, still with the same strange messages. What is the debug output that you get near the start of your debugging sessions? Do you see any of the same messages I've pasted?

SWY1985 commented 7 years ago

I've upgraded the project to work with the latest .NET Core version (1.1.1) and to use .csproj instead of project.json. Please update to the latest code.

I assume that doesn't fix debugging. There's one thing I can think off that might work. Can you press Ctrl+Shift+P and run the following command: image

After pressing enter you might get an error message from VScode that the action failed, but after a while the bottom console will show a message that it has worked. After that debugging might work.

AlexFolland commented 7 years ago

I can press enter there, with what I see in your screenshot showing, but it doesn't seem to do anything. There's no feedback whatsoever anywhere that I can find on my own. I waited several minutes. Then, I tried debugging and the result was identical.

wenisman commented 7 years ago

having the same issue. no dotnet debugging, is there a work around or resolution yet?

SWY1985 commented 7 years ago

I have tried on about 5 machines, running Windows, Linux and macOS and I haven't had any problems with debugging. Unless I can reproduce this, it's going to be very difficult to figure out what's happening. If anyone else has an idea, please let me know...

For now, you could try opening the project in Visual Studio Community Edition and see if debugging works from there...

SWY1985 commented 6 years ago

Out of nowhere, I have the same problem now.

SWY1985 commented 6 years ago

It seems to be caused by OpenTK, which is only unofficially working on .NET Core. I'm considering getting rid of OpenTK (sooner, rather than later) in favour of my own SDL implementation, which is going to take a while to develop. I'll see what I can come up with today.

SWY1985 commented 6 years ago

I've tested it on my Linux machines and they all work find. It appears to be a Windows-only problem... and probably not every Windows installation either.

wenisman commented 6 years ago

Seems to have resolved with a fresh install of vs code, but it was happening on my Mac so not a Windows only big I'm afraid

SWY1985 commented 6 years ago

Unfortunately, that (reinstallation) solved some but not all of the problems I have with VS code. I can't debug the OpenTK version on one of my (Windows) computers now. My other Windows machine has no issues, and on Linux everything also works fine.

The debugger crashes when creating an OpenTK window.

I'll try to find a solution to this...

SWY1985 commented 6 years ago

The SDL runtime is now default. #419 Could you please check if debugging works now?

SWY1985 commented 6 years ago

Can anyone confirm that this is still an issue? I've been running CivOne on many Windows, Linux an Mac installations and I have not encountered this problem anymore.

akshri250 commented 6 years ago

Still facing the issue:


You may only use the Microsoft .NET Core Debugger (vsdbg) with Visual Studio Code, Visual Studio or Visual Studio for Mac software to help you develop and test your applications.

Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded 'C:\Users\Sony\source\repos\CoreStore\CoreStore.Tests\bin\Debug\netcoreapp2.0\CoreStore.Tests.dll'. Symbols loaded. Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The program '[8472] CoreStore.Tests.dll' has exited with code 0 (0x0).

washraf commented 6 years ago

I have the same issue on .net core v 2.0 with asp.net running under service fabric

timcash commented 4 years ago

Just got the same error trying to follow the instructions here https://docs.microsoft.com/en-us/aspnet/core/blazor/get-started?view=aspnetcore-3.1&tabs=visual-studio-code

Downloading the SDK here https://dotnet.microsoft.com/download/dotnet-core/3.1

SDK 3.1.300 https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.1.300-windows-x86-installer