Skip to content

Known issues in .NET8

Alex Soto edited this page Aug 8, 2023 · 11 revisions

This document lists known issues in the SDKs.

Launching from the command line is awkward

Launching an app in the simulator (iOS, tvOS)

  1. Use the following command to get a list of all the simulators:
$ /Applications/Xcode.app/Contents/Developer/usr/bin/simctl list
  1. Choose one, and copy the corresponding UDID.

  2. Set the _DeviceName property like this to select the simulator:

dotnet build -t:Run -p:_DeviceName=:v2:udid=<UDID>

Note that a simulator runtime identifier must be used (either set in the project file, or passed to the command above like this: /p:RuntimeIdentifier=iossimulator-x64).

Launching an app on device (iOS, tvOS)

  1. Open Xcode, then the menu Window -> Devices and Simulators.

  2. Choose a device on the left, and copy the Identifier from the device info section.

  3. Set the _DeviceName property like this to select the device:

dotnet build -t:Run -p:_DeviceName=<IDENTIFIER>

Note that a device runtime identifier must be used (either set in the project file, or passed to the command above like this: /p:RuntimeIdentifier=ios-arm64).

Launching an app on desktop (macOS, Mac Catalyst)

Just dotnet run should work just fine.

If something goes wrong (the app crashes, etc.), it's often useful to see stdout and stderr (Console.Out / Console.Error) from the app (this can even be useful as a debugging mechanism in certain cases). In order to see this output, it's necessary to execute the actual macOS executable directly from the terminal. The executable can be found inside the Contents/MacOS directory of the app, which can be found in the output directory.

An example path for a Mac Catalyst app built for x86_64 (relative to the project directory):

$ ./bin/Debug/net6.0-maccatalyst/maccatalyst-x64/MySimpleApp.app/Contents/MacOS/MySimpleApp
[output]

If the app is a universal app (built for both x64 and arm64), the path to the app won't contain the runtime identifier:

$ ./bin/Debug/net6.0-maccatalyst/MySimpleApp.app/Contents/MacOS/MySimpleApp
[output]

Ref: https://github.com/dotnet/xamarin/issues/26.

Mac Catalyst app signed with a provisioning profile with configuration "Mac Catalyst" crashes at launch.

A Mac Catalyst app with entitlements and signed with a macOS provisioning profile with configuration "Mac Catalyst" crashes at launch with "Security policy does not allow @ path expansion".

There are two known workarounds:

  1. Add the following to the project file:

    <PropertyGroup>
      <_LibMonoLinkMode>Static</_LibMonoLinkMode>
      <_LibXamarinLinkMode>Static</_LibXamarinLinkMode>
    </PropertyGroup>

    Ref: https://github.com/xamarin/xamarin-macios/issues/14686#issuecomment-1106418177

  2. Use a provisioning profile with configuration "Mac" instead of "Mac Catalyst"

    See: https://github.com/xamarin/xamarin-macios/issues/14686#issuecomment-1109808007

Ref: https://github.com/xamarin/xamarin-macios/issues/14686

Selecting the simulator architecture remotely from Windows

When:

  • Building remotely from Visual Studio (on Windows).
  • Building for the simulator.
  • The remote mac is an ARM64 machine.

Visual Studio will build using the iossimulator-arm64 RuntimeIdentifier.

For some projects this may not work correctly (in particular projects that depend on third-party native libraries that don't provide an iossimulator-arm64 version of their library), and for those cases it's possible to make Visual Studio build using iossimulator-x64 instead, by setting the following property in the project file:

<PropertyGroup>
  <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>

This is supported starting in Visual Studio 17.7 preview 3.


ILLINK : error MT2301: The linker step 'Setup' failed during processing: Failed to parse PList data type: dict

In macOS If you are using .NET 8 Preview 7 and you also have .NET 8 Preview 6 installed in your system, you will be running into the following error when you try to build your project:

ILLink : unknown error IL7000: An error occured while executing the custom linker steps. Please review the build log for more information.
ILLINK : error MT2301: The linker step 'Setup' failed during processing: Failed to parse PList data type: dict
/Users/<user>/.nuget/packages/microsoft.net.illink.tasks/8.0.0-preview.7.23375.6/build/Microsoft.NET.ILLink.targets(84,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.

This is a known issue and in order to workaround it you will need to remove some preview 6 files from your system.

First make sure that you do have .NET 8 Preview 6 and .NET 8 Preview 7 by running the following command in your terminal: dotnet --info and you should see in the terminal output:

.NET SDKs installed:
  8.0.100-preview.6.23330.14 [/usr/local/share/dotnet/sdk]
  8.0.100-preview.7.23376.3 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.0-preview.6.23329.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-preview.7.23375.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.0-preview.6.23329.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-preview.7.23375.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Removing /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.6.23329.7 from your system should get rid of the linker error and you can do this by executing the following command in your terminal followed by your user password:

sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-preview.6.23329.7

Once done you can clean your project and try to build again.

Clone this wiki locally