This repository reproduces the issue described in Sentry .NET issue #4427 regarding the IsPortableCodeView property on CodeView directory entries in .NET 9 MAUI applications.
When building a .NET 9 MAUI application targeting iOS in release mode, IsPortableCodeView should be true in the CodeView debug directory entry. It appears to incorrectly return false since the MinorVersion is set to 0.
git clone <repository-url>
cd is-portableFind the relevant device ID for your iOS simulator. You can list available simulators with:
xcrun xctrace list devicesNow run build the test app and deploy it to the simulator:
dotnet build -c Release --framework net9.0-ios /p:RuntimeIdentifier=iossimulator-arm64 /t:Run ./MauiTestApp/MauiTestApp.csproj /p:_DeviceName=:v2:udid=<DeviceId>A side effect of this step is that various files will be generated in the bin and obj directories, including multiple MauiTestApp.dll files.
dotnet run --project PeReaderAppThe console application will read the PE header of the various MauiTestApp.dll files and display some information from the debug directory entries, including the IsPortableCodeView property.
IsPortableCodeViewshould betruefor all of the assemblies. This should only return true for Windows PDB files (not relevant when running on iOS).
IsPortableCodeViewis showing asfalsefor the PE file located atMauiTestApp/obj/Release/net9.0-ios/iossimulator-arm64/stripped/MauiTestApp.dll. This is problematic since this appears to be the assembly that is actually used when running the app on the iOS simulator (where we're also observing the issue with theIsPortableCodeViewproperty).
When running the PE reader, you should see output similar to:
binFile
=============================
Found 3 debug directory entries:
Type: CodeView
IsPortableCodeView: True
Guid: 7a75b1de-313d-1a76-d796-2e25687d73d9
Stamp: 12ac34c1
Age: 1
objBase
=============================
Found 3 debug directory entries:
Type: CodeView
IsPortableCodeView: True
Guid: 7a75b1de-313d-1a76-d796-2e25687d73d9
Stamp: 12ac34c1
Age: 1
objStripped
=============================
Found 1 debug directory entries:
Type: CodeView
IsPortableCodeView: False
Guid: 7a75b1de-313d-1a76-d796-2e25687d73d9
Stamp: 689ab509
Age: 1