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

[BUG] Can't attach debuger to simulator when build config is customized #1072

Closed
espritm opened this issue Apr 19, 2024 · 4 comments
Closed
Assignees
Labels
area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire area-maui bug Something isn't working triaged The issue has been triaged vs-sync Add this label to synchronize the issue to AzDo vs-syncd Linked to AzDO
Milestone

Comments

@espritm
Copy link

espritm commented Apr 19, 2024

Describe the Issue

I am migrating from .Net7 to .Net8 a MAUI application project. So I need to migrate from VS For Mac to VS Code too.

I have several build configurations, DebugEV1, DebugEV2 (and other for prod and release..).
But I cannot use them successfully is VS Code.

In debug mode, the breackpoints are not reached with iOS simulator.
The debuger is not attached. Sometime, the debuger is attached, but is detached after 2 seconds after the splashscreen appear.

Was working perfectly with VS For Mac for years (Xamarin.Forms, then MAUI net6, net7, ...)

Steps To Reproduce

1 Create a new .NET MAUI Project
2 In the csproj, add the following line :

	   <Configurations>DebugEV2</Configurations> 

3 Add the following launch.json :

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "DebugEV2",
            "type": "maui",
            "request": "launch",
            "preLaunchTask": "maui: Build",
            "configuration": "DebugEV2"
        },
        {
            "name": "Debug",
            "type": "maui",
            "request": "launch",
            "preLaunchTask": "maui: Build",
            "configuration": "Debug"
        }
    ]
}

4 Put an accessible breackpoint, for instance in the MainPage.xml.cs in the OnCounterClicked method.
5 Run and Debug the app on ios simulator with config Debug : OK the breakpoint is reached.
6 Run and Debug the app on ios simulator with config DebugEV2 : BUG : can't reach the breakpoint, the debuger is not attached.

Expected Behavior

The breakpoint should be reached.
The debuger should always be attached.

Environment Information

Visual Studio Code
Version: 1.88.0 (Universal)
Commit: 5c3e652f63e798a5ac2f31ffd0d863669328dc4c
Date: 2024-04-03T13:28:18.899Z (6 days ago)
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 23.1.0

.NET MAUI extension v0.9.7

C# extension v2.23.15

C# Dev Kit v1.4.29

dotnet 8.0.203
| VS Bug 2046825

@espritm espritm added the bug Something isn't working label Apr 19, 2024
@webreidi webreidi added area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire area-maui labels Apr 19, 2024
@mauroa
Copy link
Member

mauroa commented Apr 22, 2024

Hi @espritm.
This issue should be fixed by updating .NET MAUI to latest pre-release, as well as the C# extension.
Could you please confirm? Thanks for your help.

@mauroa mauroa added triaged The issue has been triaged needs-more-info Needing more information, waiting on OP labels Apr 22, 2024
@mauroa mauroa self-assigned this Apr 22, 2024
@espritm
Copy link
Author

espritm commented Apr 23, 2024

Hi @mauroa
Thanks a lot for your answer.
I have upgraded to latest pre-released versions.
I have removed bin and obj folders.
Now the debuger is not lost (the debug bar still appears).
But I still can't reach the breackpoint, see the picture below. Breackpoints are grey out and the message "No symbols have been loaded for this document." appears when I place the mouse on one of the breackpoints.

image

With "Debug" config, the breackpoints are still reached.

C# v2.26.13 (pre-release)
C# Dev Kit v1.5.14 (pre-release)
.NET MAUI v0.11.16 (pre-release)

@github-actions github-actions bot removed the needs-more-info Needing more information, waiting on OP label Apr 23, 2024
Copy link

@mauroa, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.

@mauroa mauroa added the vs-sync Add this label to synchronize the issue to AzDo label Apr 25, 2024
@AllenD-MSFT AllenD-MSFT added the vs-syncd Linked to AzDO label Apr 25, 2024
@mauroa mauroa added this to the Post GA milestone Apr 25, 2024
@mauroa mauroa assigned tondat and unassigned mauroa Apr 25, 2024
@emaf
Copy link
Member

emaf commented Apr 25, 2024

@espritm to enable debugging for iOS you need to set the following property, otherwise the debug symbols won't be included in your app bundle:

	<PropertyGroup Condition="'$(Configuration)' == '<your custom configuration>'">
		<_BundlerDebug>true</_BundlerDebug>
	</PropertyGroup>

The iOS SDK sets this value to true by default for the Debug config.

I'm closing this, but feel free to reopen it if you keep experiencing this issue.

@emaf emaf closed this as completed Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire area-maui bug Something isn't working triaged The issue has been triaged vs-sync Add this label to synchronize the issue to AzDo vs-syncd Linked to AzDO
Projects
None yet
Development

No branches or pull requests

6 participants