sdk-container-builds icon indicating copy to clipboard operation
sdk-container-builds copied to clipboard

Missing debug profile (compability) with worker projects

Open Herdo opened this issue 1 year ago • 4 comments

I've tried to enable debugging a worker project using the SDK container build, but failed to do so. Apparently, only the Web SDK supports SDK container style debugging.

It'd be great if the other SDKs would also support the SDK container style debugging like the Web SDK does.

I tried with this project and launch settings:

Worker.csproj

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

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <LangVersion>latest</LangVersion>
  </PropertyGroup>

  <PropertyGroup>
    <IsPublishable>true</IsPublishable>
    <EnableSdkContainerSupport>true</EnableSdkContainerSupport>
    <EnableSdkContainerDebugging>True</EnableSdkContainerDebugging>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
    <ContainerRuntimeIdentifier>linux-x64</ContainerRuntimeIdentifier>
    <ContainerRepository>test-worker</ContainerRepository>
    <ContainerImageTag>latest</ContainerImageTag>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
  </ItemGroup>
</Project>

launchSettings.json

{
  "profiles": {
    "Container (.NET SDK)": {
      "commandName": "SdkContainer",
      "launchBrowser": false,
      "environmentVariables": {
        "DOTNET_ENVIRONMENT": "Development"
      }
    }
  },
  "$schema": "http://json.schemastore.org/launchsettings.json"
}

Results in Visual Studio 17.9 giving me this error message: grafik

When chaning the project SDK to Microsoft.NET.Sdk.Web, debugging works fine.

Publishing is not affected. This works fine. The debug functionality is missing.

Herdo avatar Apr 23 '24 16:04 Herdo

Interesting catch! @danegsta is this something that should be reported in VS developer community for triage on the VS docker tools side?

baronfel avatar Apr 23 '24 16:04 baronfel

Broadly speaking in 8.0.100 Worker SDK projects should be able to be debugged in this way, and from 8.0.200 onwards any project with the EnableSdkContainerSupport property set to true should be able to be debugged in this way.

baronfel avatar Apr 23 '24 16:04 baronfel

Installed SDK version is 8.0.204.

For me it feels like the Visual Studio tooling is lacking some things, as most of it had to be assembled by hand, taken from the Web SDK. Just reporting here due to the error message.

Herdo avatar Apr 23 '24 17:04 Herdo

Sorry @Herdo - you're totally right, my comments were intended for the VS Docker tools team as a guideline for how to think about what project types can be containerized in what SDK versions when updating the VS features. No reflection on you or your report at all.

baronfel avatar Apr 23 '24 17:04 baronfel

@Herdo please raise this over at the VS Developer Community portal to get it seen by the appropriate team.

baronfel avatar Oct 09 '24 15:10 baronfel