dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.51k stars 10.04k forks source link

Breakpoint does not get hit when using Blazor Webassembly with HttpSys #28671

Open bleissem opened 3 years ago

bleissem commented 3 years ago

Describe the bug

When using Blazor Webassembly version 5.0.1 and then putting

 webBuilder.UseHttpSys(options =>
                    {
                        options.Authentication.Schemes =
                            AuthenticationSchemes.NTLM |
                            AuthenticationSchemes.Negotiate;
                        options.Authentication.AllowAnonymous = false;
                        options.AllowSynchronousIO = true;
                    });

into program.cs after starting Visual Studio to debug a blazor webassembly no breakpoint is hit anymore. See also: https://github.com/bleissem/DebuggingWithAspNetCoreAndHttpSys/blob/main/breakpoint_does_not_get_hit.jpg

To Reproduce

I made a repo to reproduce this issue https://github.com/bleissem/DebuggingWithAspNetCoreAndHttpSys/ the main branch is the brach that contains UseHttpSys the worksfine branch ist the one that works fine with breakpoints without using UseHttpSys

You can see the difference between both branches here

Exceptions (if any)

Further technical details

version that is used: .Net 5.0.1

dotnet --info:

.NET SDK (gemäß "global.json"): Version: 5.0.101 Commit: d05174dc5a

Laufzeitumgebung: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.101\

Host (useful for support): Version: 5.0.1 Commit: b02e13abab

.NET SDKs installed: 5.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download

Visual Studio Version: 16.8.3

ghost commented 3 years ago

Thanks for contacting us. We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

mkArtakMSFT commented 3 years ago

Thanks for contacting us. @Tratcher do you happen to know whether the use of HTTP Sys is compatible with WebSockets?

Tratcher commented 3 years ago

Yes it is on Win8+ and it looks like they're using Win10 here.

@bleissem does it work if you disable auth?

@BrennanConroy don't client websockets have to opt-into auth?

Tratcher commented 3 years ago

Side note @bleissem, why did you set AllowSynchronousIO? That usually indicates you're working around a bug.

BrennanConroy commented 3 years ago

don't client websockets have to opt-into auth?

No, however there are issues with WebSockets and Windows Auth in some browsers. For example, Chrome and Safari will not work with WebSockets + Windows Auth. (I don't know if I've tried Edge since it changed to use Chromium, so it might not work either)

bleissem commented 3 years ago

@Tratcher Thanks for investigating this. I'm using Windows 10. I removed setting AllowSynchronousIO in main branch and pushed the branches: main and worksfine again. In worksfine branch I just removed the IIS Express settings from launchSettings.json. Not using UseHttpSys in Program.cs works, but we want to achive windows authentication by using UseHttpSys. Now UseHttpSys is used this way:

                webBuilder.UseHttpSys(options =>
                {
                    options.Authentication.Schemes =
                        AuthenticationSchemes.NTLM |
                        AuthenticationSchemes.Negotiate;
                    options.Authentication.AllowAnonymous = false;
                });

I made a video from my screen, so you might get a better impression from what is going on on my machine. That video also shows an error message that is shown by Visual Studio sometimes, so I had luck recording this error message. My feeling is that I need to restart Visual Studio to be able to use breakpoints again in worksfine branch but not in main branch.

Tratcher commented 3 years ago

@bleissem I know you want auth for your scenario, but to help debug this issue can you try UseHttpSys without auth to see if that's the problem?

bleissem commented 3 years ago

@Tratcher Thanks for your fast response. I don't understand what you mean with: "try UseHttpSys without auth" Do you want me to try: calling webBuilder.UseHttpSys(); or do you want me to try: omit calling webBuilder.UseHttpSys(); ( this is already done in the worksfine branch ) or something else ?

Tratcher commented 3 years ago

Please try webBuilder.UseHttpSys();. When you omit UseHttpSys you end up using the default Kestrel server instead. We want to confirm that auth is the issue and not something else with the HttpSys server.

bleissem commented 3 years ago

@Tratcher When using webBuilder.UseHttpSys(); the breakpoint works as expected. I just made another video

Tratcher commented 3 years ago

Thanks, that confirms it is the auth issue. It's likely a client limitation as @BrennanConroy said. We'll investigate and see if we can find a way to improve the experience.

hfirst commented 3 years ago

I am having similar issue but has nothing to do with HttpSys. If I create a Blazor WebAssembly project (non-ssl) using the following in my server.csproj:

PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="5.0.0-preview.6.20312.15"

my breakpoints in the client razor page code sections fire.

If I switch to:

PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="5.0.1"

my breakpoints no longer fire.

ghost commented 3 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.