VS Code debugger failing when debugging MAUI IOS app

I have a dotnet 8 MAUI IOS application that I have developed using VS code. I would really like to take advantage of the built in debugger but it won’t boot the app in a simulator. I have seen many similar posts like this all without resolution or if they were resolved the solution did not work for me. First, here is my launch and tasks files:

launch.json

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>{
"version": "0.2.0",
"configurations": [
{
"name": ".NET MAUI iOS Simulator",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\bNow listening on:\s+(https?://\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
}
]
}
</code>
<code>{ "version": "0.2.0", "configurations": [ { "name": ".NET MAUI iOS Simulator", "type": "coreclr", "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.dll", "args": [], "cwd": "${workspaceFolder}", "stopAtEntry": false, "serverReadyAction": { "action": "openExternally", "pattern": "\bNow listening on:\s+(https?://\S+)" }, "env": { "ASPNETCORE_ENVIRONMENT": "Development" }, "sourceFileMap": { "/Views": "${workspaceFolder}/Views" } } ] } </code>
{
    "version": "0.2.0",
    "configurations": [
      {
        "name": ".NET MAUI iOS Simulator",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceFolder}/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.dll",
        "args": [],
        "cwd": "${workspaceFolder}",
        "stopAtEntry": false,
        "serverReadyAction": {
          "action": "openExternally",
          "pattern": "\bNow listening on:\s+(https?://\S+)"
        },
        "env": {
          "ASPNETCORE_ENVIRONMENT": "Development"
        },
        "sourceFileMap": {
          "/Views": "${workspaceFolder}/Views"
        }
      }
    ]
  }

tasks.json

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/TIMS.csproj",
"-c", "Debug",
"-r", "iossimulator-arm64", // Runtime Identifier for Simulator
"-f", "net8.0-ios"
],
"problemMatcher": "$msCompile"
}
]
}
</code>
<code>{ "version": "2.0.0", "tasks": [ { "label": "build", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/TIMS.csproj", "-c", "Debug", "-r", "iossimulator-arm64", // Runtime Identifier for Simulator "-f", "net8.0-ios" ], "problemMatcher": "$msCompile" } ] } </code>
{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "build",
        "command": "dotnet",
        "type": "process",
        "args": [
          "build",
          "${workspaceFolder}/TIMS.csproj",
          "-c", "Debug",
          "-r", "iossimulator-arm64",  // Runtime Identifier for Simulator
          "-f", "net8.0-ios"
        ],
        "problemMatcher": "$msCompile"
      }
    ]
  }

This is in my csproj file:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-ios</TargetFramework>
<RuntimeIdentifiers>iossimulator-arm64</RuntimeIdentifiers>
<MtouchLink>SdkOnly</MtouchLink>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<SelfContained>false</SelfContained>
<OutputType>Exe</OutputType>
<RootNamespace>TIMS</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Display name -->
<ApplicationTitle>TIMS</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.edu.tims</ApplicationId>
<ApplicationIdGuid>baa91138-79c0-4181-a545-399c98881b95</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>6.9</ApplicationDisplayVersion>
<ApplicationVersion>6.9</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage>
<CodesignProvision>Automatic</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<MtouchLink>None</MtouchLink> <!-- No linking for Debug builds -->
<MtouchDebug>true</MtouchDebug> <!-- Enables debug mode -->
<MtouchUseLlvm>false</MtouchUseLlvm> <!-- Disables LLVM to avoid inlining issues -->
<UseNativeHttpHandler>false</UseNativeHttpHandler>
<SelfContained>false</SelfContained>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage>
<CodesignProvision>Automatic</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
<SelfContained>false</SelfContained>
</PropertyGroup>
</code>
<code><Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net8.0-ios</TargetFramework> <RuntimeIdentifiers>iossimulator-arm64</RuntimeIdentifiers> <MtouchLink>SdkOnly</MtouchLink> <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks> <SelfContained>false</SelfContained> <OutputType>Exe</OutputType> <RootNamespace>TIMS</RootNamespace> <UseMaui>true</UseMaui> <SingleProject>true</SingleProject> <ImplicitUsings>enable</ImplicitUsings> <!-- Display name --> <ApplicationTitle>TIMS</ApplicationTitle> <!-- App Identifier --> <ApplicationId>com.edu.tims</ApplicationId> <ApplicationIdGuid>baa91138-79c0-4181-a545-399c98881b95</ApplicationIdGuid> <!-- Versions --> <ApplicationDisplayVersion>6.9</ApplicationDisplayVersion> <ApplicationVersion>6.9</ApplicationVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'"> <CreatePackage>false</CreatePackage> <CodesignProvision>Automatic</CodesignProvision> <CodesignKey>iPhone Distribution</CodesignKey> <DebugType>portable</DebugType> <DebugSymbols>true</DebugSymbols> <MtouchLink>None</MtouchLink> <!-- No linking for Debug builds --> <MtouchDebug>true</MtouchDebug> <!-- Enables debug mode --> <MtouchUseLlvm>false</MtouchUseLlvm> <!-- Disables LLVM to avoid inlining issues --> <UseNativeHttpHandler>false</UseNativeHttpHandler> <SelfContained>false</SelfContained> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'"> <CreatePackage>false</CreatePackage> <CodesignProvision>Automatic</CodesignProvision> <CodesignKey>iPhone Distribution</CodesignKey> <SelfContained>false</SelfContained> </PropertyGroup> </code>
<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>net8.0-ios</TargetFramework>
        <RuntimeIdentifiers>iossimulator-arm64</RuntimeIdentifiers>
        <MtouchLink>SdkOnly</MtouchLink>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
        <SelfContained>false</SelfContained>
        <OutputType>Exe</OutputType>
        <RootNamespace>TIMS</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>

        <!-- Display name -->
        <ApplicationTitle>TIMS</ApplicationTitle>

        <!-- App Identifier -->
        <ApplicationId>com.edu.tims</ApplicationId>
        <ApplicationIdGuid>baa91138-79c0-4181-a545-399c98881b95</ApplicationIdGuid>

        <!-- Versions -->
        <ApplicationDisplayVersion>6.9</ApplicationDisplayVersion>
        <ApplicationVersion>6.9</ApplicationVersion>

        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
      <CreatePackage>false</CreatePackage>
      <CodesignProvision>Automatic</CodesignProvision>
      <CodesignKey>iPhone Distribution</CodesignKey>
      <DebugType>portable</DebugType>
      <DebugSymbols>true</DebugSymbols>
      <MtouchLink>None</MtouchLink> <!-- No linking for Debug builds -->
      <MtouchDebug>true</MtouchDebug> <!-- Enables debug mode -->
      <MtouchUseLlvm>false</MtouchUseLlvm> <!-- Disables LLVM to avoid inlining issues -->
      <UseNativeHttpHandler>false</UseNativeHttpHandler>
      <SelfContained>false</SelfContained> 
    </PropertyGroup>
    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
      <CreatePackage>false</CreatePackage>
      <CodesignProvision>Automatic</CodesignProvision>
      <CodesignKey>iPhone Distribution</CodesignKey>
      <SelfContained>false</SelfContained> 
    </PropertyGroup>

I am not getting any errors anywhere other than the debugger console where I am getting these:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/bin/Debug/net8.0-ios/iossimulator-arm64/'.
Failed to run as a self-contained app.
- The application was run as a self-contained app because '/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.runtimeconfig.json' did not specify a framework.
- If this should be a framework-dependent app, specify the appropriate framework in '/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.runtimeconfig.json'.
The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core.
</code>
<code>A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/bin/Debug/net8.0-ios/iossimulator-arm64/'. Failed to run as a self-contained app. - The application was run as a self-contained app because '/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.runtimeconfig.json' did not specify a framework. - If this should be a framework-dependent app, specify the appropriate framework in '/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.runtimeconfig.json'. The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core. </code>
A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/bin/Debug/net8.0-ios/iossimulator-arm64/'.

Failed to run as a self-contained app.
 - The application was run as a self-contained app because '/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.runtimeconfig.json' did not specify a framework.
 
 - If this should be a framework-dependent app, specify the appropriate framework in '/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.runtimeconfig.json'.

The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core.

The only problem I can find is that my runtimeconfig.json has this:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>{
"runtimeOptions": {
"tfm": "net8.0",
"includedFrameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "8.0.8"
},
{
"name": "Microsoft.iOS",
"version": "17.5.8020"
}
],
</code>
<code>{ "runtimeOptions": { "tfm": "net8.0", "includedFrameworks": [ { "name": "Microsoft.NETCore.App", "version": "8.0.8" }, { "name": "Microsoft.iOS", "version": "17.5.8020" } ], </code>
{
  "runtimeOptions": {
    "tfm": "net8.0",
    "includedFrameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "8.0.8"
      },
      {
        "name": "Microsoft.iOS",
        "version": "17.5.8020"
      }
    ],

And so I think that it doesn’t like “`tfmand wantsframeworks““ there instead, but that is an auto-generated file so I’m not sure how to fix this.

I really don’t know what else to try that I haven’t already. Any help is greatly appreciated.

I am using xCode version 15.4 and VS Code version 1.92.2.

1

Failed to run as a self-contained app.

  • The application was run as a self-contained app because ‘/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.runtimeconfig.json’ did
    not specify a framework.

  • If this should be a framework-dependent app, specify the appropriate framework in
    ‘/bin/Debug/net8.0-ios/iossimulator-arm64/TIMS.runtimeconfig.json’.

The error indicates that the application is not finding the required dynamic library (libhostpolicy.dylib) and is having issues with the runtimeconfig.json file.

  1. Please ensure that you’ve installed the latest .NET SDK which
    supports iOS development.
  2. As Yansho said in the comments, sometimes, cleaning and rebuilding the project can resolve issues with missing files or misconfigurations.
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>dotnet clean
dotnet build
</code>
<code>dotnet clean dotnet build </code>
dotnet clean
dotnet build
  1. Since runtimeconfig.json is mentioned in the error report, you also need to check runtimeconfig.json. The runtimeconfig.json is usually auto-generated, but you can manually verify its content. Ensure it specifies the correct framework and versions. If you suspect issues with auto-generation, try regenerating it by cleaning and rebuilding the project.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật