Skip to content

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

Closed as not planned
@tuanchien

Description

@tuanchien

Type: Bug

Apologies if this is filed with the wrong project. Originally filed with onnxruntime but yuslepukhin from that project suggested it's worth filing a report with VSCode to see if it's an IDE issue.

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. This appears to be a debugger issue.

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

VS Code version: Code 1.101.0 (Universal) (dfaf441, 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) 2, 2, 3
Memory (System) 8.00GB (0.15GB free)
Process Argv --crash-reporter-id 647029fc-6931-4857-87ab-c260309d8fe7
Screen Reader no
VM 0%
Extensions (35)
Extension Author (truncated) Version
cake-vscode cak 2.1.1
doxdocgen csc 1.4.0
xamlstyler dab 1.4.0
vscode-markdownlint Dav 0.60.0
docker doc 0.10.0
metal-shader dou 1.0.5
gitlens eam 17.1.1
EditorConfig Edi 0.17.4
copilot Git 1.335.0
copilot-chat Git 0.28.0
better-cpp-syntax jef 1.27.1
vscode-containers ms- 2.0.3
csdevkit ms- 1.20.35
csharp ms- 2.80.16
dotnet-maui ms- 1.9.21
vscode-dotnet-runtime ms- 2.3.5
vscodeintellicode-csharp ms- 2.2.3
debugpy ms- 2025.8.0
isort ms- 2025.0.0
python ms- 2025.6.1
vscode-pylance ms- 2025.6.1
jupyter ms- 2025.5.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.1.0
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
cmake-tools ms- 1.20.53
cpptools ms- 1.25.3
cpptools-extension-pack ms- 1.3.1
hexeditor ms- 1.11.1
powershell ms- 2025.0.0
rust-analyzer rus 0.3.2490
cmake twx 0.0.17
intellicode-api-usage-examples Vis 0.2.9
vscodeintellicode Vis 1.3.2

(1 theme extensions excluded)

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

Labels

*caused-by-extensionIssue identified to be caused by an extension

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions