Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ExecutionEngineException creating Microsoft.ML.OnnxRuntime.SessionOptions #23263

Open
DennyOne opened this issue Jan 6, 2025 · 6 comments
Labels
api:CSharp issues related to the C# API .NET Pull requests that update .net code

Comments

@DennyOne
Copy link

DennyOne commented Jan 6, 2025

Describe the issue

This issue is reported by https://developercommunity.visualstudio.com/user/25004 and moved from https://developercommunity.visualstudio.com/t/SystemExecutionEngineException-creating/10794175 to onnx/onnx#6555

@justinchuby closed onnx/onnx#6555 and suggested creating the issue here.


Hi devs!

I have a C#.NET project that uses the Microsoft.ML.OnnxRuntime and Microsoft.ML.OnnxRuntime.Managed packages.

System.ExecutionEngineException error began while creating Microsoft.ML.OnnxRuntime.SessionOptions when the Microsoft.ML.OnnxRuntime and Microsoft.ML.OnnxRuntime.Managed Version=1.19.2 packages were updated to Version=1.20.0.

Do the 1.20.0 (or higher) packages include all required dependencies? Do I need to add any other NuGet packages? Previous version packages (1.19.2 or lower) work without issue.

The project uses the following ONNX packages:
Microsoft.ML.OnnxRuntime Version=1.19.2
Microsoft.ML.OnnxRuntime.Managed Version=1.19.2
TorchSharp Version=0.105.0
TorchSharp-cpu Version=0.105.0

Much Thanks!
-Denny

To reproduce

Unfortunately, I do not have a small sample that can reproduce the issue. If it might be helpful, a Visual Studio debug video was posted in the original issue (https://developercommunity.visualstudio.com/t/SystemExecutionEngineException-creating/10794175)

Urgency

Our project cannot use updated Microsoft.ML.OnnxRuntime versions higher than 1.19.2

Platform

Windows

OS Version

10 & 11

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.20.0

ONNX Runtime API

C#

Architecture

X64

Execution Provider

Other / Unknown

Execution Provider Library Version

No response

@github-actions github-actions bot added .NET Pull requests that update .net code api:CSharp issues related to the C# API labels Jan 6, 2025
@skottmckay
Copy link
Contributor

Is there any log output?

If not, ensure that the OrtEnv instance has been created prior to doing anything with the session options. Simplest is to call OrtEnv.Instance() and ignore the return value.

@DennyOne
Copy link
Author

DennyOne commented Jan 7, 2025

@skottmckay Here's what happens when I try to call OrtEnv.Instance()

Image

@DennyOne
Copy link
Author

DennyOne commented Jan 7, 2025

It looks like the same exception:

Image

@yuslepukhin
Copy link
Member

It is likely to be a dependency problem.
Also, you want to dispose of the objects as soon as they are no longer needed. Do not rely on the finalizers, they almost never run.

@DennyOne
Copy link
Author

DennyOne commented Jan 7, 2025

Thanks for the finalizer suggestion; I can fix that by implementing IDisposable. Are there missing dependencies in the released Microsoft.ML.OnnxRuntime(and .Managed) Version=1.20.0 packages? The project has worked for quite some time using 1.19.2 and previous versions, and continues to work when I roll back to 1.19.2 package version.

@yuslepukhin
Copy link
Member

We are not aware of any missing dependencies.
With the debugger at hand, you are in a good position to find out what is going on.
Using dumpbin /DEPENDENTS and where in your environment can enable you quickly to pinpoint what is missing what needs to be either added to PATH or deployed in in the location where the system can find them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:CSharp issues related to the C# API .NET Pull requests that update .net code
Projects
None yet
Development

No branches or pull requests

3 participants