Upstream: dotnet#7359
Status: COMPLETE
Classification: bug-report
Confidence: 0.75
Reproduced: ⏭️ Skipped
Area: ONNX
Investigated at: 2026-03-07
Triage Summary
Category: Bug Report
Reasoning: The user reports a System.AccessViolationException when building and running the official OnnxObjectDetectionApp sample project. This is unexpected behavior from an officially provided sample and indicates a defect — either in the sample itself, in the ML.NET ONNX integration, or in a native dependency version mismatch. The issue has been labeled onnx and assigned to a core team member, confirming it is treated as a bug.
Summary: The user runs the samples\csharp\end-to-end-apps\ObjectDetection-Onnx\OnnxObjectDetectionApp sample on Windows 10/11 with ML.NET v1.6 and .NET 8.0 using Visual Studio 2022 (17.13.0). Upon running the app, a System.AccessViolationException ("Attempted to read or write protected memory") is thrown. The expected behavior is a live webcam object detection overlay using ML.NET and ONNX.
Suggested Labels: bug, needs-info
Reproduction Results
Reproduction was skipped for the following reasons:
- The sample app (
OnnxObjectDetectionApp) requires a physical webcam for live video feed input, which is unavailable in this CI/Linux environment.
- The issue is Windows-specific (reported on Windows 10/11 with Visual Studio 2022), and the
System.AccessViolationException is likely tied to a native ONNX runtime interop or a platform-specific memory access issue.
- Running the full WinForms/WPF camera capture pipeline is not feasible in a headless Linux container.
Notes
- The issue was triaged by the ML.NET team and placed on the ML.NET Future milestone, indicating it is acknowledged but not immediately scheduled.
- The
System.AccessViolationException in ONNX contexts typically points to native memory corruption in the ONNX Runtime native library, possibly due to:
- A mismatch between the managed ML.NET wrapper and the native ONNX Runtime version bundled with
Microsoft.ML.OnnxRuntime.
- The sample targeting an outdated ONNX model or API version incompatible with the current runtime.
- A regression introduced in a newer version of Visual Studio 2022 or .NET 8.0 runtime affecting the native P/Invoke layer.
- The relevant source for investigation would be
src/Microsoft.ML.OnnxRuntime*/ and the sample at samples/csharp/end-to-end-apps/ObjectDetection-Onnx/.
Generated by Triage Single Issue · ◷
Upstream: dotnet#7359
Status: COMPLETE
Classification: bug-report
Confidence: 0.75
Reproduced: ⏭️ Skipped
Area: ONNX
Investigated at: 2026-03-07
Triage Summary
Category: Bug Report
Reasoning: The user reports a
System.AccessViolationExceptionwhen building and running the officialOnnxObjectDetectionAppsample project. This is unexpected behavior from an officially provided sample and indicates a defect — either in the sample itself, in the ML.NET ONNX integration, or in a native dependency version mismatch. The issue has been labeledonnxand assigned to a core team member, confirming it is treated as a bug.Summary: The user runs the
samples\csharp\end-to-end-apps\ObjectDetection-Onnx\OnnxObjectDetectionAppsample on Windows 10/11 with ML.NET v1.6 and .NET 8.0 using Visual Studio 2022 (17.13.0). Upon running the app, aSystem.AccessViolationException("Attempted to read or write protected memory") is thrown. The expected behavior is a live webcam object detection overlay using ML.NET and ONNX.Suggested Labels: bug, needs-info
Reproduction Results
Reproduction was skipped for the following reasons:
OnnxObjectDetectionApp) requires a physical webcam for live video feed input, which is unavailable in this CI/Linux environment.System.AccessViolationExceptionis likely tied to a native ONNX runtime interop or a platform-specific memory access issue.Notes
System.AccessViolationExceptionin ONNX contexts typically points to native memory corruption in the ONNX Runtime native library, possibly due to:Microsoft.ML.OnnxRuntime.src/Microsoft.ML.OnnxRuntime*/and the sample atsamples/csharp/end-to-end-apps/ObjectDetection-Onnx/.