Describe the issue
In my Azure DevOps CI pipeline, I am running into the following exception:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Microsoft.ML.OnnxRuntime.InferenceSession.Init(System.String, Microsoft.ML.OnnxRuntime.SessionOptions, Microsoft.ML.OnnxRuntime.PrePackedWeightsContainer)
This occurs at the following code:
public OnnxModel()
{
var sessionOptions = new Microsoft.ML.OnnxRuntime.SessionOptions
{
InterOpNumThreads = 1,
IntraOpNumThreads = 1,
};
// crash is right here
session = new InferenceSession(SileroConfiguration.ModelLocation, sessionOptions);
}
I have installed the runtime via the following NuGet package:
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.24.4" />
I am trying to load the model provided by Silero VAD. This model loads fine on my development machine (Windows 11), and when I deploy to my lab server (Windows Server 2022).
I am sure the native libraries are found because the SessionOptions object is created successfully.
Things I Tried
- I made sure the model was found.
File.Exists() shows true for my model file.
- I tried downgrading to previous versions (1.22.1, 1.23.2) of the nuget package.
- I tried switching
EnableCpuMemArena true and false.
- I tried
sessionOptions.SetEpSelectionPolicy(ExecutionProviderDevicePolicy.PREFER_CPU);
- I tried
sessionOptions.AppendExecutionProvider_CPU(0);
- I made sure the Azure-hosted machine supports AVX:
var hasAvx = (GetEnabledXStateFeatures() & 4) != 0;
Debug.Assert(hasAvc);
What am I doing wrong here?
To reproduce
I'm not sure how best to allow for a reproduction, since I can only make it happen on Azure DevOps runners.
Here are the stats on the DevOps image: https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-VS2026-Readme.md
Urgency
No response
Platform
Windows
OS Version
Windows Server 2025 with Visual Studio 2026
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
NuGet package 1.24.4
ONNX Runtime API
C#
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
Describe the issue
In my Azure DevOps CI pipeline, I am running into the following exception:
This occurs at the following code:
I have installed the runtime via the following NuGet package:
I am trying to load the model provided by Silero VAD. This model loads fine on my development machine (Windows 11), and when I deploy to my lab server (Windows Server 2022).
I am sure the native libraries are found because the SessionOptions object is created successfully.
Things I Tried
File.Exists()shows true for my model file.EnableCpuMemArenatrue and false.sessionOptions.SetEpSelectionPolicy(ExecutionProviderDevicePolicy.PREFER_CPU);sessionOptions.AppendExecutionProvider_CPU(0);What am I doing wrong here?
To reproduce
I'm not sure how best to allow for a reproduction, since I can only make it happen on Azure DevOps runners.
Here are the stats on the DevOps image: https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-VS2026-Readme.md
Urgency
No response
Platform
Windows
OS Version
Windows Server 2025 with Visual Studio 2026
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
NuGet package 1.24.4
ONNX Runtime API
C#
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response