dotnet / dotnet/diagnostics

Using libsos on a Mac Catalyst app (built with CoreCLR) fails with "Failed to load data access module, 0x80004002"

Open
#5,912 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
1.3k
Forks
404
Avg merge
2d 5h
Merged PRs (30d)
35

Description

### Description

Using libsos on a Mac Catalyst app (built with CoreCLR) fails with:

> Failed to load data access module, 0x80004002

To repro, install .NET 11 preview 5 and:

```shell
dotnet workload install maccatalyst
mkdir sos-maccatalyst
cd sos-maccatalyst
dotnet new maccatalyst
dotnet build
lldb -- bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/sos-maccatalyst.app/Contents/MacOS/sos-maccatalyst
(lldb) plugin load /Users/rolf/.dotnet/sos/libsosplugin.dylib
(lldb) run
(lldb)
(lldb) clrstack
Failed to load data access module, 0x80004002
Can not load or initialize libmscordaccore.dylib. The target runtime may not be initialized.

For more information see https://go.microsoft.com/fwlink/?linkid=2135652
ClrStack failed
```

### Configuration

macOS 26.5.1 (Tahoe), M2 Pro (ARM64)

```
(lldb) sosstat
Target OS: OSX Architecture: Arm64 ProcessId: 66500 (0x103C4)
#0 .NET Core runtime 11.0.26.30315 at 0000000100A64000 size 004DC000 index be5a19368985322ea69ba41c1a3dbf50
Runtime module path: /Users/rolf/test/bugs/sos-maccatalyst/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/sos-maccatalyst.app/Contents/MonoBundle/libcoreclr.dylib
DAC: /Users/rolf/test/bugs/sos-maccatalyst/bin/Debug/net11.0-maccatalyst/maccatalyst-arm64/sos-maccatalyst.app/Contents/MonoBundle/libmscordaccore.dylib (don't verify)
Exports:
DotNetRuntimeInfo:
g_dacTable: 0000000100F0E398
DotNetRuntimeDebugHeader:
DotNetRuntimeContractDescriptor: 0000000100F0A248
SpecialDiagInfoHeader : 7FFFFFFF10000000
Settings:
-> Use CDAC contract reader: False
-> Force use CDAC contract reader: False
-> DAC signature verification check enabled: False
Current symbol store settings:
Extensions loaded:
-> 9.0.661903+d7b455b46332b31fd9ba3a3f3e020387984c511a /Users/rolf/.dotnet/sos/Microsoft.Diagnostics.ExtensionCommands.dll
Host runtime .NET 9.0.15 on Darwin 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:39:09 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T6020 Arm64
GC memory usage for managed SOS components: 3,682,744 bytes
```

dotnet --info

```
.NET SDK:
Version: 11.0.100-preview.5.26302.115
Commit: f7b4c5716f
Workload version: 11.0.100-preview.5.26309.3
MSBuild version: 18.8.0-preview-26302-115+f7b4c5716

Runtime Environment:
OS Name: Mac OS X
OS Version: 26.5
OS Platform: Darwin
RID: osx-arm64
Base Path: /Users/rolf/Library/Application Support/dotnet/sdk/11.0.100-preview.5.26302.115/

.NET workloads installed:
[macos]
Installation Source: SDK 11.0.100-preview.5
Manifest Version: 26.5.11546-net11-p5/11.0.100-preview.5
Manifest Path: /Users/rolf/Library/Application Support/dotnet/sdk-manifests/11.0.100-preview.5/microsoft.net.sdk.macos/26.5.11546-net11-p5/WorkloadManifest.json
Install Type: FileBased

[ios]
Installation Source: SDK 11.0.100-preview.5
Manifest Version: 26.5.11546-net11-p5/11.0.100-preview.5
Manifest Path: /Users/rolf/Library/Application Support/dotnet/sdk-manifests/11.0.100-preview.5/microsoft.net.sdk.ios/26.5.11546-net11-p5/WorkloadManifest.json
Install Type: FileBased

[maccatalyst]
Installation Source: SDK 11.0.100-preview.5
Manifest Version: 26.5.11546-net11-p5/11.0.100-preview.5
Manifest Path: /Users/rolf/Library/Application Support/dotnet/sdk-manifests/11.0.100-preview.5/microsoft.net.sdk.maccatalyst/26.5.11546-net11-p5/WorkloadManifest.json
Install Type: FileBased

[maui]
Installation Source: SDK 11.0.100-preview.5
Manifest Version: 11.0.0-preview.5.26304.4/11.0.100-preview.5
Manifest Path: /Users/rolf/Library/Application Support/dotnet/sdk-manifests/11.0.100-preview.5/microsoft.net.sdk.maui/11.0.0-preview.5.26304.4/WorkloadManifest.json
Install Type: FileBased

Configured to use workload sets when installing new manifests.

Host:
Version: 11.0.0-preview.5.26302.115
Architecture: arm64
Commit: f7b4c5716f

.NET SDKs installed:
10.0.301 [/Users/rolf/Library/Application Support/dotnet/sdk]
11.0.100-preview.5.26302.115 [/Users/rolf/Library/Application Support/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.9 [/Users/rolf/Library/Application Support/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 11.0.0-preview.5.26302.115 [/Users/rolf/Library/Application Support/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.9 [/Users/rolf/Library/Application Support/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 11.0.0-preview.5.26302.115 [/Users/rolf/Library/Application Support/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
x64 [/usr/local/share/dotnet/x64]
registered at [/etc/dotnet/install_location_x64]

Environment variables:
DOTNET_CLI_TELEMETRY_OPTOUT [1]
DOTNET_ROOT [/Users/rolf/Library/Application Support/dotnet]

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download
```

### Regression?

Probably not, because building Mac Catalyst apps with CoreCLR is new.

### Other information

Terminal log: https://gist.github.com/rolfbjarne/b456aef303c25012f0b320a463e19345

App bundle: [sos-maccatalyst-dotnet-diagnostics-5912.zip](https://onedrive.cloud.microsoft/:u:/a@d4ap3hl2/S/IQAB2PXOQ1WySacjQjW6oHQ3AcEE1Y_ikLiLS3YcoBlquvM?e=Yxz8B3)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided Mac Catalyst reproducer: install the listed .NET 11 preview and maccatalyst workload, build the app, then load libsosplugin.dylib in lldb and run sosstat followed by clrstack. Trace the data access module loading for the bundled libmscordaccore.dylib; done means clrstack initializes and displays the managed stack instead of reporting 0x80004002.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, macos
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.