Skip to content

How to fix the error: clang exited with code 1

Nikita Romanov edited this page Aug 19, 2024 · 4 revisions

By default .NET Meteor uses the runtime identifier that match your PC architecture (iossimulator-arm64 - for Mac with Apple chip, iossimulator-x64 - for Mac with Intel chip). If you want to change this behavior, you can do the following:

  1. Create the .vscode/tasks.json file with the following content:
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "dotnet-meteor.task",
            "target": "build",
            "label": "Build without runtimeId",
	    "args": [
                // It removes auto provided value
                "-p:RuntimeIdentifier="
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

You can leave the -p:RuntimeIdentifier= property empty or specify your custom value (for example: -p:RuntimeIdentifier=iossimulator-x64).

  1. Create or edit the .vscode/launch.json file:
{
    "version": "0.2.0",
    "configurations": [
        {
            // Default configuration
            "name": ".NET Meteor Debugger",
            "type": "dotnet-meteor.debugger",
            "request": "launch",
            "preLaunchTask": "dotnet-meteor: Build",
        },
        {
            // Your new configuration for iossimulator-x64 only
            "name": "(simX64) .NET Meteor Debugger",
            "type": "dotnet-meteor.debugger",
            "request": "launch",
            // You can specify path to the application here
            "program": "${workspaceFolder}/bin/Debug/net8.0-ios/iossimulator-x64/MyMauiApplication.app",
            // This label should be the same as in the tasks.json file
            "preLaunchTask": "Build without runtimeId",
        }
    ]
}
  1. Now you can select this new configuration in the VSCode debug window and run your application.


Additional info

You can also change your device settings instead of specifying program property in the launch.json. For example:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(simX64) .NET Meteor Debugger",
            "type": "dotnet-meteor.debugger",
            "request": "launch",
            "device": {
                "serial": "${command:dotnet-meteor.activeDeviceSerial}",
                "runtime_id": "iossimulator-x64",
                "platform": "ios",
                "is_emulator": true,
            },
            "preLaunchTask": "Build without runtimeId"
        }
    ]
}

The command dotnet-meteor.activeDeviceSerial contains a serial number of the selected device in the status bar. For additonal properties, see device.ts file.