Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET Core App project Debug properties are missing "enable native code debugging" checkbox #1125

Closed
tmat opened this issue Jan 10, 2017 · 65 comments
Assignees
Labels
Feature-.NET-Core Feature-Debugging Launching an application via F5, setting debug properties and launch profiles. Triage-Approved Reviewed and prioritized
Milestone

Comments

@tmat
Copy link
Member

tmat commented Jan 10, 2017

Desktop projects have
image

I can't find this option in .NET Core project. I need to F5 with mixed mode debugging in order to debug some interop code.

@tmat
Copy link
Member Author

tmat commented Jan 10, 2017

Oh, I guess I know why:

image

Seems like the debugger doesn't support interop debugging with CoreCLR :(

@tmat
Copy link
Member Author

tmat commented Jan 11, 2017

@noahfalk I hear this is CoreCLR issue but I couldn't find an issue in the coreclr repo that would be tracking it.

@noahfalk
Copy link
Member

@mikem8361 might be able to point you at something or you can create one now

@mikem8361
Copy link
Member

The latest coreclr master branch (.NET Core 2.0) has mixed mode debugging enabled for Windows.

@davkean davkean added this to the 1.1 milestone Jan 23, 2017
@srivatsn srivatsn modified the milestones: 16.0, 15.3 Apr 3, 2017
@axel-habermaier
Copy link

axel-habermaier commented Jun 3, 2017

Since this checkbox will apparently not be implemented in VS2017, is there any workaround apart from starting the program and attaching the debugger manually? This is extremely cumbersome as I have to guess the right "dotnet" process in the process list, since I have multiple dotnet core applications running concurrently, but I only want to debug a specific one.

@axel-habermaier
Copy link

I tried adding <EnableUnmanagedDebugging>true</EnableUnmanagedDebugging> to a PropertyGroup of the csproj file, but unfortunately, it had no effect. Would it be possible to implement support for the functionality even without exposing it in the UI, if there is not enough time to do both?

@davkean
Copy link
Member

davkean commented Jun 5, 2017

Hmm, looks like we don't currently respect the legacy debugger settings with the new debugger provider that we wrote. This is where we control it: https://github.com/dotnet/project-system/blob/master/src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Debug/ProjectDebuggerProvider.cs#L76, that's really unfortunate, because the provider that this replaces does support it.

@srivatsn Given interop debugging is supported in 2.0, we should enable this for 2.0.

@srivatsn srivatsn modified the milestones: 15.3, 16.0 Jun 5, 2017
@srivatsn srivatsn modified the milestones: 15.4, 15.3 Jun 20, 2017
@srivatsn srivatsn modified the milestones: 16.0 Preview1, 15.4 Jul 31, 2017
@clairernovotny
Copy link
Member

Keep in mind that this also affects SDK-style projects that only target .NET Desktop. I have a .NET Framework exe using the SDK project system and have a need to do mixed mode debugging. I need a cumbersome hack (use a start program from a legacy project pointing to the output of the SDK project)

@davidmatson
Copy link

davidmatson commented Aug 23, 2017

@onovotny: I have the exact same setup (.NET Desktop with new-style csproj).

Any updates on when this checkbox will be added to VS for Common Project System-based csprojs? Is it likely to make it into 15.4? (or there's a 15.7?)

@davkean davkean modified the milestones: 15.6, 15.7, 15.5 Aug 24, 2017
@davkean
Copy link
Member

davkean commented Aug 24, 2017

@davidmatson Oren has a PR out - this will make 15.5.

@zezba9000
Copy link

zezba9000 commented Nov 28, 2018

I'm running into this issue which is effecting xUnit / .NET Standard.

<EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>

Does not work in xUnit.

Trying to debug some C# NamedPipes with C ones in a single Unit Test.

@davkean
Copy link
Member

davkean commented Nov 28, 2018

What version? I think 15.8 or 15.9 Test Explorer was changed to respect this setting.

@zezba9000
Copy link

zezba9000 commented Nov 28, 2018

I'm on:
Win10 x64
VS 15.9.2
xUnit + .NET Core 2.1 (Testing .NET Standard 2.0 and external C API)
VC++ 10.0.17763.0

My csproj settings look like:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>

    <IsPackable>false</IsPackable>
    <EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
    <PackageReference Include="xunit" Version="2.3.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\VRstudios.Networking\VRstudios.Networking.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="Newtonsoft.Json">
      <HintPath>Newtonsoft.Json</HintPath>
    </Reference>
  </ItemGroup>

  <ItemGroup>
    <None Update="HttpRootResourcePath\index.html">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>

@davkean
Copy link
Member

davkean commented Nov 28, 2018

We don't currently respect that property, you need to add "nativeDebugging" : true to your launchprofile, here's an example: https://github.com/dotnet/project-system/blob/master/src/ProjectSystemSetup/Properties/launchSettings.json#L24.

@zezba9000
Copy link

zezba9000 commented Nov 28, 2018

Ok that works for me tnx! VS C# proj control panel should really have this option for .NET Core apps.
Humans are visual creatures after all.

{
	"profiles": {
		"Start (with native debugging)": {
			"nativeDebugging": true
		}
	}
}

@davkean
Copy link
Member

davkean commented Nov 28, 2018

That's exactly what this bug is tracking. :)

@davkean davkean added Help Wanted Feature-Debugging Launching an application via F5, setting debug properties and launch profiles. and removed Bug labels Nov 28, 2018
rokups pushed a commit to rbfx/rbfx that referenced this issue Dec 9, 2018
Works for .Net with Visual Studio 2017.

Does not work with .Net Core as per dotnet/project-system#1125
@morganbr
Copy link

This will get more important for .NET Core 3.0 when C++/CLI is enabled, since it will only support mixed-mode assemblies.

@jjmew jjmew added the Triage-Approved Reviewed and prioritized label Jan 10, 2019
@deedubb
Copy link

deedubb commented Jan 13, 2019

Jumping on the "me too" bandwagon to see if we can get this prioritized higher.

It's mostly annoying because I spent 15 minutes searching for the option in VS options, then project properties, and then implementing the hack.

How about the exception intellisense have an option to enable native debugging when it detects a native exception?

@vatsan-madhavan
Copy link
Member

Would be nice if this could be prioritized and fixed in Dev16 soon. Given how often we in the WPF team tend to debug into the native stack, our development processes frequently involve native debugging.

I just stumbled upon this and figured out how to enable native-debugging for Sdk style projects. Now it's one more thing that has to be turned on for every test project or application we investigate for problems. Just being able to turn it on in the VS UI would be nice.

@m17kea
Copy link

m17kea commented Feb 28, 2019

Win10 x64
VS2017
Nunit 3.11
c++ v141
Resharper

For anyone using Resharper, the launchsettings.json nativedebugging flag is ignored and breakpoints are not hit. Once I disabled it and ran from Test Explorer the breakpoints hit.

@etbyrd
Copy link
Contributor

etbyrd commented Mar 11, 2019

Fixed in #4624

@etbyrd etbyrd closed this as completed Mar 11, 2019
@branko-d
Copy link

branko-d commented Jun 18, 2019

Hi, is there a way to start debugging C# and then step into T-SQL, like it was possible with older versions of Visual Studio and pre-SDK projects?

My use case is described here.

@jmarolf
Copy link
Contributor

jmarolf commented Jun 18, 2019

@branko-d can you please file a new issue on this repo?

@branko-d
Copy link

@branko-d can you please file a new issue on this repo?

Created: #4935.

@fpelliccioni
Copy link

We don't currently respect that property, you need to add "nativeDebugging" : true to your launchprofile, here's an example: https://github.com/dotnet/project-system/blob/master/src/ProjectSystemSetup/Properties/launchSettings.json#L24.

Do you know how to achieve the same using VSCode?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-.NET-Core Feature-Debugging Launching an application via F5, setting debug properties and launch profiles. Triage-Approved Reviewed and prioritized
Projects
None yet
Development

No branches or pull requests