Skip to content

VSCode (mac) debugger breakpoint on C# onnxruntime (nuget) GetTensorDataAsSpan leads to app crash evaluating SpanDebugView #8369

Open
@tuanchien

Description

@tuanchien

Type: Bug

Apologies if this is filed with the wrong project. Originally filed with onnxruntime but it was referred to VSCode. Now referred to an extension project. Seems plausible it's a dotnet runtime problem too.

Problem

With a dotnet MAUI project targeting net9.0-maccatalyst using onnxruntime (nuget), the attached debugger can sometimes crash if you set a break point in a function which calls GetTensorDataAsSpan. Even if the break point occurs before that method is evaluated.

It will crash with

The target process exited with code 0 (0x00000000) while evaluating the function 'System.SpanDebugView<T>.SpanDebugView'.

If no break point is set, the code will produce results as expected.

On VSCode windows, if we switch the target framework to net9.0-windows and attempt to debug at the same location, the app will NOT crash.

This problem still exists on the VSCode 1.102 insiders build with only 4 extensions installed (C#, C# Dev Kit, .NET MAUI, .NET Install Tool)

A repo containing some minimal code to reproduce the issue is available at:
https://github.com/tuanchien/spandebugview-vscode-mac-onnxruntime-issue

Set the break point, run the app with the debugger attached, and click the button in the app to trigger the crash.
If you copy and paste the contents of RunOnnxStuff into OnCounterClicked instead, and set a break point inside there, then it does not appear to crash.

Environment
Dotnet SDK: 9.0.301
Onnx runtime (nuget) 1.22.0

Extension version: 2.80.16
VS Code version: Code 1.101.0 (Universal) (dfaf44141ea9deb3b4096f7cd6d24e00c147a4b1, 2025-06-11T15:00:50.123Z)
OS version: Darwin arm64 24.5.0
Modes:

System Info
Item Value
CPUs Apple M1 (8 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 4, 3, 4
Memory (System) 8.00GB (0.17GB free)
Process Argv --crash-reporter-id 647029fc-6931-4857-87ab-c260309d8fe7
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
vscaac:30438847
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupytercf:31046870
newcmakeconfigv2:31071590
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc2:31192216
cf971741:31144450
iacca1:31171482
notype1:31157159
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions