maui icon indicating copy to clipboard operation
maui copied to clipboard

Breakpoints do not work when debugging configuration other than Debug

Open jump32 opened this issue 1 year ago • 4 comments

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 avatar Jan 24 '24 14:01 jump32

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

jump32 avatar Jan 24 '24 17:01 jump32

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.

GalaxiaGuy avatar Jan 26 '24 12:01 GalaxiaGuy

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.

ghost avatar Jan 26 '24 15:01 ghost

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 avatar Jan 26 '24 18:01 GalaxiaGuy

Just join the dots for related issues:

Very similar sounding issue, but also including a crash: https://github.com/dotnet/maui/issues/20211

Open issue in dotnet runtime outlining how mobile apps more routinely need more configurations: https://github.com/dotnet/sdk/issues/31918

GalaxiaGuy avatar Jan 30 '24 09:01 GalaxiaGuy

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.

AllenD-MSFT avatar Jan 30 '24 16:01 AllenD-MSFT

@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.

jump32 avatar Jan 30 '24 17:01 jump32

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.

AllenD-MSFT avatar Jan 30 '24 17:01 AllenD-MSFT

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.

AllenD-MSFT avatar Mar 04 '24 17:03 AllenD-MSFT

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

samhouts avatar Apr 22 '24 17:04 samhouts