question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't debug WPF project after upgrade from .NET5 to .NET6

See original GitHub issue
  • .NET Core Version: 6.0.100
  • Windows version: Windows 11 Pro
  • IDE: Visual Studio 2022 and Rider
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Have not tried but it’s working in .NET5.

Problem description: Changed from .NET5 to .NET6 by changing TargetFramework in .csproj. I now get the error message in VS2022: “Unable to attach to CoreCLR. Operation not supported. Unknown error: 0x80004005.” Publish and “Start without debugging” works, both in VS and Rider.

What I have tried:

  1. I have uppdated all nugets
  2. Re-installed Visual Studio 2022
  3. Re-installed .Net6
  4. Clean and rebuild.

Actual behavior: Visual Studio error message: Visual Studio error message

Rider error message: C:\Users\user\AppData\Local\JetBrains\Toolbox\apps\Rider\ch-0\212.5284.64\lib\ReSharperHost\JetBrains.Debugger.Worker64c.exe --mode=client --frontend-port=53344 --plugins=C:\Users\user\AppData\Local\JetBrains\Toolbox\apps\Rider\ch-0\212.5284.64\plugins\rider-unity\dotnetDebuggerWorker One or more errors have occurred.

csproj

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

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <UseWPF>true</UseWPF>
    <RuntimeIdentifier>win10-x64</RuntimeIdentifier>
    <PublishSingleFile>true</PublishSingleFile>
    <ApplicationIcon>Business_Target.ico</ApplicationIcon>
    <UseWindowsForms>False</UseWindowsForms>
    <ImplicitUsings>disable</ImplicitUsings>
	<SelfContained>true</SelfContained>
	<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\ProjectOrganizer.Dto\ProjectOrganizer.Dto.csproj" />
    <ProjectReference Include="..\ProjectOrganizer.Shared\ProjectOrganizer.Shared.csproj">
    </ProjectReference>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="AsyncAwaitBestPractices" Version="6.0.2" />
    <PackageReference Include="Autofac" Version="6.3.0" />
    <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
    <PackageReference Include="DevExpress.Images" Version="21.2.3" />
    <PackageReference Include="DevExpress.Wpf" Version="21.2.3" />
    <PackageReference Include="DevExpress.Wpf.Themes.Office2019Black" Version="21.2.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.0" />
    <PackageReference Include="Mono.Cecil" Version="0.11.4" />
    <PackageReference Include="Polly.Extensions.Http" Version="3.0.0" />
    <PackageReference Include="Prism.Core" Version="8.1.97" />
  </ItemGroup>

</Project>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Reelixcommented, Nov 11, 2021

If your project is set to PublishSingleFile, this issue is being tracked over at https://github.com/dotnet/runtime/issues/45382

1reaction
EtherGhostcommented, Nov 12, 2021

@Reelix Wow, that helped! Thank’s a lot! I did not think that PublishSingleFile would apply to debug at all, only when publish. Thank’s! @lindexi Thank you for your help too!

Read more comments on GitHub >

github_iconTop Results From Across the Web

with Debugging fails after upgrade from .NET5 to .NET6 on ...
After this change, you'll able to run with Debugging. This issue mentioned and solved on these topics. You may check the details.
Read more >
Can't start debugging a .NET 5 WPF desktop application
I've tried to debug a .NET 5 WPF desktop application. The application is started but waits for the debugger initialization. The result is...
Read more >
Started to get "This project is targeting a version of .NET ...
1). In VS Installer > Individual components tab > check if components like .NET 5.0 Runtime or related components are checked. If it/they...
Read more >
Write and debug code by using Hot Reload - Visual Studio ...
Update running code with Hot Reload. Open a project based on a supported application type. For more information on .NET, see .NET application...
Read more >
Visual Studio freezes when hitting a breakpoint in a WPF ...
It only happens in my WPF solution, I didn't notice any problems while debugging my ASP.NET project (completely different solution/project).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found