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

Breakpoints do not work when debugging configuration other than Debug #20132

Closed
jump32 opened this issue Jan 24, 2024 · 10 comments
Closed

Breakpoints do not work when debugging configuration other than Debug #20132

jump32 opened this issue Jan 24, 2024 · 10 comments
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/iOS 🍎 s/move-to-vs-feedback Tells automation to ask the person to use VS Feedback to report the issue t/bug Something isn't working

Comments

@jump32
Copy link

jump32 commented Jan 24, 2024

Description

When building a configuration named other than 'Debug' breakpoints no longer appear to work. This is despite the fact that the configuration should be a debug configuration.

Additional notes:

Despite the use of VS Code in the repo steps below, we see similar behaviour in Rider. Suggesting that the IDE is not the source of the issue.

Steps to Reproduce

  1. Download example repo project.
  2. Open is VS Code
  3. Debug the 'Debug' configuration on an iOS simulator
  4. Set a breakpoint on MainPage.xaml.cs - OnCounterClicked
  5. Click on the 'Click Me' button in the app and observe the breakpoint being hit

Then:

  1. Change the configuration to 'Broken'
  2. Debug the app again
  3. App will run
  4. Click on the 'Click Me' button but the breakpoint no longer gets triggered

Link to public reproduction project repository

https://github.com/jump32/maui-app-debug-issue/tree/main

Version with bug

8.0.3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

VS Code with latest Dev Kit extensions. Xcode 15.1.0, iOS 17.2 on iPhone simulator

Did you find any workaround?

None found so far.

Relevant log output

No response

@jump32 jump32 added the t/bug Something isn't working label Jan 24, 2024
@jump32
Copy link
Author

jump32 commented Jan 24, 2024

There appears to be a workaround to this issue. The workaround is to add a specific property to the configuration in a property group.
<PropertyGroup Condition=" '$(Configuration)' == 'Broken' "> <_BundlerDebug>true</_BundlerDebug> </PropertyGroup>

Referencing this link for the workaround:
https://developercommunity.visualstudio.com/t/Can-not-deploy-iOS-simulator-build-in-al/10327626?q=Show+html+generated+in+build+pipeline+on+Dashboard

This is however, just a workaround, and should ultimately be fixed in either MAUI or .NET

@samhouts samhouts added the area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging label Jan 25, 2024
@GalaxiaGuy
Copy link
Contributor

I am now getting similar behavior on that sample app if I try Android (I just changed the .csproj to have <TargetFrameworks>net8.0-ios;net8.0-android</TargetFrameworks>.

In Debug, it launches and hits breakpoints, in Broken it launches, but does not breakpoints.

<_BundlerDebug>true</_BundlerDebug> has no effect.

@PureWeen PureWeen added the s/move-to-vs-feedback Tells automation to ask the person to use VS Feedback to report the issue label Jan 26, 2024
@ghost
Copy link

ghost commented Jan 26, 2024

Thanks for the issue report @jump32! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.

If you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.

  1. Go to the Visual Studio for Windows feedback tool or Visual Studio for Mac feedback tool to report the issue
  2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.

@GalaxiaGuy
Copy link
Contributor

Although I accept this may not be the correct repo to find a fix, I don't think it is a problem with Visual Studio. Neither Visual Studio nor Visual Studio for Mac were used, just VS Code and Rider.

After searching for _BundlerDebug, I would guess the Xamarin iOS repo might be the actual source based on:

https://github.com/xamarin/xamarin-macios/blob/c548f80a4da49917cacbb42000af964860af44b1/msbuild/Xamarin.Shared/Xamarin.Shared.props#L229

https://github.com/xamarin/xamarin-macios/blob/c548f80a4da49917cacbb42000af964860af44b1/dotnet/targets/Xamarin.Shared.Sdk.targets#L108

@GalaxiaGuy
Copy link
Contributor

Just join the dots for related issues:

Very similar sounding issue, but also including a crash:
#20211

Open issue in dotnet runtime outlining how mobile apps more routinely need more configurations:
dotnet/sdk#31918

@AllenD-MSFT
Copy link

This issue is being looked at in the .NET MAUI Extension for VS Code where we expect that a fix will be made. If we find that the issue is deeper in the SDK, then we'll work with the MAUI SDK team to devise a fix. I expect a fix for .NET MAUI Extension for VS Code before GA is declared and likely within a month from now.

@jump32
Copy link
Author

jump32 commented Jan 30, 2024

@AllenD-MSFT Thank you for the update. As a reminder we are also seeing the issue with Rider. Suggesting that the issue is probably deeper than just the VS Code extension. But thank you for the update all the same.

@AllenD-MSFT
Copy link

We've looked into the code in our MAUI DevKit extension and found the root cause there. I suspect that other tools may also have similar issues with configuration handling. Likely Rider has a similar bug that MAUI DevKit has.

@rachelkang rachelkang added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Feb 1, 2024
@AllenD-MSFT
Copy link

FYI: This issue has been fixed in MAUI DevKit (.NET MAUI Extension for VS Code). I'm leaving the issue open since there are indications that this problem is also occurring with other tools which may be indicative of a problem deeper in the tech stack, but may also simply be duplicate bugs in other tools.

@samhouts
Copy link
Member

I'm going to go ahead and close this one, since there's no action for the MAUI team to take here. Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/iOS 🍎 s/move-to-vs-feedback Tells automation to ask the person to use VS Feedback to report the issue t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants