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

[iOS] Custom Debug Configuration Issue & Crash #20211

Closed
RobFrancisAu opened this issue Jan 28, 2024 · 16 comments
Closed

[iOS] Custom Debug Configuration Issue & Crash #20211

RobFrancisAu opened this issue Jan 28, 2024 · 16 comments
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging platform/iOS 🍎 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working

Comments

@RobFrancisAu
Copy link

RobFrancisAu commented Jan 28, 2024

Description

Hi All,

I am trying to create a custom debug configuration called DemoDebug in a Maui project.
When trying to run the project on an iOS simulator (I have not tried other platforms), I have the two following issues;

The property group I am using in my .csproj looks like this

<PropertyGroup Condition=" '$(Configuration)' == 'DebugDemo' ">
        <DefineConstants>DEBUGDEMO</DefineConstants>
        <DebugSymbols>true</DebugSymbols>
        <DebugType>full</DebugType>
        <Optimize>false</Optimize>
        <MtouchDebug>true</MtouchDebug>
</PropertyGroup>
  1. When running using this configuration, without including MtouchDebug, the debugger is never attached and therefore no breakpoints are hit.
  2. Adding <MtouchDebug>true</MtouchDebug> crashes the app at startup.

I have attached a sample project. here CustomDebugConfiguration.zip

Thanks in advance.

Steps to Reproduce

  1. Create a new Maui project.
  2. Create a copy the Debug configuration named DebugDemo.
  3. Attempt to hit a breakpoint

Link to public reproduction project repository

No response

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

No response

Did you find any workaround?

Currently unable to find a workaround.

Relevant log output

No response

@RobFrancisAu RobFrancisAu added the t/bug Something isn't working label Jan 28, 2024
@drasticactions
Copy link
Contributor

Can you try this with a net8.0-ios app (dotnet new ios) that doesn't include the MAUI UI framework?

@drasticactions drasticactions added the s/needs-info Issue needs more info from the author label Jan 29, 2024
@ghost
Copy link

ghost commented Jan 29, 2024

Hi @RobFrancisAu. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@RobFrancisAu
Copy link
Author

RobFrancisAu commented Jan 29, 2024

Can you try this with a net8.0-ios app (dotnet new ios) that doesn't include the MAUI UI framework?

@drasticactions, this works CustomConfigurationIos.zip.

<MtouchDebug>true</MtouchDebug> is required to enable the debugger, as expected. However it does not crash the app as it does in Maui.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Jan 29, 2024
@drasticactions
Copy link
Contributor

drasticactions commented Jan 29, 2024

@rolfbjarne Do you need to set that value yourself in newer dotnet projects? I'm looking at the props files and from memory those values were set in Framework project files but that's not the case now.

FWIW I did get a crash too, but that could be due to changing settings that are already handled by the SDK tooling (Or maybe there's a conflict between settings changed by MAUI props vs. SDK ones?). If I remove that setting and attach the debugger, it's fine.

@rolfbjarne
Copy link
Member

We set MtouchDebug=true if Configuration="Debug", so for other debug-like configurations with a different name you'll have to set it in the csproj (there's an issue in dotnet/sdk about improving this: dotnet/sdk#31918).

Setting MtouchDebug=true shouldn't cause a crash, do you have a crash report / stack trace?

@RobFrancisAu
Copy link
Author

Here is a crash report.
Crash_Report.txt

And a snippet of the device logs around the crash.
Console

@rolfbjarne
Copy link
Member

Does it help if you clean the project first?

@RobFrancisAu
Copy link
Author

Does it help if you clean the project first?

Nope, tried all of that.

  • Clean & rebuild.
  • Delete the bin & obj folders, force Nuget restore, rebuild etc...

Is this not reproducible at your end then with the project I provided?

I created the sample app (attached in the first post) to ensure I could reproduce it. The problem actually became apparent in a different project I was working on.

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

@RobFrancisAu which IDE and OS are you using?

@RobFrancisAu
Copy link
Author

@RobFrancisAu which IDE and OS are you using?

JetBrains Rider : 2023.3.3
MacOS : 14.2.1

@rolfbjarne
Copy link
Member

@drasticactions you said you could reproduce a crash; which IDE and OS was that with? Do you have a stack trace / crash report?

@kevinxufei
Copy link

Verified this issue with Visual Studio for mac 17.6.10(build428). Can not repro this issue with Android/iOS platforms.(Maui Version:8.0.14/8.0.3/8.0.0-rc.2.9530)

@kevinxufei kevinxufei added s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels Apr 1, 2024
Copy link
Contributor

Hi @RobFrancisAu. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@sullivanmj
Copy link

I am seeing the same behavior on the latest version of Visual Studio for Mac

VS for Mac version 17.6.10 (build 428).
XCode 15.2
Microsoft.Maui.Controls package version 8.0.6
Workload versions:

dotnet workload list

Installed Workload Id      Manifest Version       Installation Source
---------------------------------------------------------------------
maui-ios                   8.0.7/8.0.100          SDK 8.0.200        
maui-android               8.0.7/8.0.100          SDK 8.0.200        
ios                        17.2.8043/8.0.100      SDK 8.0.200        
maui                       8.0.7/8.0.100          SDK 8.0.200        

Use `dotnet workload search` to find additional workloads to install.

It seems to be some problem related to Hot Reload. If I turn Hot Reload for MAUI off

Visual Studio > Preferences... > Other > XAML Hot Reload > .NET MAUI

Then the crash does not occur anymore, and I am able to debug, hit breakpoints, etc.

@kevinxufei kevinxufei removed the s/try-latest-version Please try to reproduce the potential issue on the latest public version label Apr 8, 2024
@samhouts samhouts removed the s/triaged Issue has been reviewed label Jul 3, 2024
@samhouts samhouts added the s/triaged Issue has been reviewed label Jul 10, 2024
@Zhanglirong-Winnie Zhanglirong-Winnie added the s/try-latest-version Please try to reproduce the potential issue on the latest public version label Sep 11, 2024
Copy link
Contributor

Hi @RobFrancisAu. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@Zhanglirong-Winnie
Copy link

This issue has been verified using Visual Studio 17.6.14(build413)(8.0.82 & 8.0.72 & 8.0.7 & 8.0.3). Not repro on 8.0.82 and 8.0.72 version. 8.0.3 and 8.0.7 do have this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 20, 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 platform/iOS 🍎 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants