Cannot debug maccatalyst target in MAUI project – Application doesn’t even launch

Using .net 8.0.100-preview.7.23376.3 and JetBrains Rider 2023.2.2:

JetBrains Rider 2023.2.2
Build #RD-232.9921.83, built on September 24, 2023
Licensed to Laerdal Medical AS / Kyriakos Sidiropoulos
You have a perpetual fallback license for this version.
Subscription is active until August 10, 2024.
Runtime version: 17.0.8+7-b1000.22 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.6.6
.NET Core v7.0.7 ARM64 (Server GC)
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 10
Metal Rendering is ON
Registry:
    ide.lookup.shrink=true
    ide.balloon.shadow.size=0
    vcs.empty.toolwindow.show=false
    ide.new.project.model.index.case.sensitivity=true
    database.show.search.tab=false

Non-Bundled Plugins:
    com.github.copilot (1.3.2.3479)
    com.jetbrains.rider.android (232.9921.83)
    com.intellij.ideolog (222.1.0.0)
    com.intellij.resharper.StructuredLogging (2023.2.0.305)
    git-extended-update-index (0.1.3)
    com.mallowigi (93.1.0)
    aws.toolkit (1.84-232)
    com.intellij.resharper.azure (3.50.0.1679-2023.2)

I created a default MAUI app from the templates and I’m trying to debug it without having made any modifications to it. The app doesn’t even launch when in debug mode even though it launches just fine in Release mode. Anyone else facing this issue? Any solutions/workarounds appreciated.

Stumbled upon people facing similar issues:

https://youtrack.jetbrains.com/issue/RIDER-79838/Cannot-debug-maccatalyst-target-in-MAUI-project

The solution to get the app to launch + debug is essentially this one (you might have to increase the timeout if 5secs is not long enough):

public class Program
{
    // This is the main entry point of the application.
    static void Main(string[] args)
    {
#if DEBUG
        // silly workaround to allow debugging of macCatalyst apps
        //
        // https://youtrack.jetbrains.com/issue/RIDER-79838/Cannot-debug-maccatalyst-target-in-MAUI-project#focus=Comments-27-7970946.0-0
        Thread.Sleep(5_000);
#endif

        // if you want to use a different Application Delegate class from "AppDelegate"
        // you can specify it here.
        UIApplication.Main(args, null, typeof(AppDelegate));
    }
}

Hope this helps some people save some time.

Leave a Comment