CivOne icon indicating copy to clipboard operation
CivOne copied to clipboard

Can't debug in Visual Studio Code

Open AlexFolland opened this issue 7 years ago • 24 comments

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).

AlexFolland avatar Mar 15 '17 04:03 AlexFolland

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

SWY1985 avatar Mar 15 '17 05:03 SWY1985

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.

SWY1985 avatar Mar 16 '17 06:03 SWY1985

I will try it.

AlexFolland avatar Mar 16 '17 07:03 AlexFolland

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 avatar Mar 16 '17 07:03 AlexFolland

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

AlexFolland avatar Mar 16 '17 07:03 AlexFolland

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 avatar Mar 16 '17 07:03 AlexFolland

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.

AlexFolland avatar Mar 16 '17 07:03 AlexFolland

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 avatar Mar 16 '17 08:03 SWY1985

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

SWY1985 avatar Mar 16 '17 08:03 SWY1985

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?

AlexFolland avatar Mar 16 '17 09:03 AlexFolland

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.

SWY1985 avatar Mar 16 '17 09:03 SWY1985

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.

AlexFolland avatar Mar 16 '17 19:03 AlexFolland

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

wenisman avatar Apr 26 '17 17:04 wenisman

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 avatar May 03 '17 07:05 SWY1985

Out of nowhere, I have the same problem now.

SWY1985 avatar Nov 13 '17 09:11 SWY1985

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 avatar Nov 13 '17 09:11 SWY1985

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.

SWY1985 avatar Nov 13 '17 09:11 SWY1985

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

wenisman avatar Nov 13 '17 10:11 wenisman

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 avatar Nov 13 '17 12:11 SWY1985

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

SWY1985 avatar Nov 15 '17 21:11 SWY1985

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.

SWY1985 avatar Mar 18 '18 18:03 SWY1985

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).

akshri250 avatar May 01 '18 15:05 akshri250

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

washraf avatar Jun 04 '18 04:06 washraf

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

timcash avatar May 21 '20 02:05 timcash