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

'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception #23300

Open
Sriharsha-medevplus opened this issue Jan 9, 2025 · 1 comment
Open
Labels
api:CSharp issues related to the C# API .NET Pull requests that update .net code

Comments

@Sriharsha-medevplus
Copy link

Sriharsha-medevplus commented Jan 9, 2025

Describe the issue

I have installed OnnxRuntime for C# using the NuGet package manager, it is working fine with my device.
but when I try to install the .net application with the model in other PC's I get: error loading image: The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception.

Object reference not set to an instance of an object.
at Microsoft.ML.OnnxRuntime.NativeMethods..cctor() in D:\a_work\1\s\csharp\src\Microsoft.ML.OnnxRuntime\NativeMethods.shared.cs:line 368

To reproduce

Image

Urgency

No response

Platform

Windows

OS Version

11/ 10

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.20.1

ONNX Runtime API

C#

Architecture

X64

Execution Provider

Default CPU

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 9, 2025
@skottmckay
Copy link
Contributor

Usually that's due to a dependency like the onnxruntime.dll not being found.

https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#standard-search-order-for-unpackaged-apps

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

2 participants