opencvsharp icon indicating copy to clipboard operation
opencvsharp copied to clipboard

Unable to load DLL OpenCvSharpExtern System.DllNotFoundException 0x8007007E when dragging control onto WinForm

Open jeffdavis503 opened this issue 1 year ago • 1 comments

Summary of your issue

When dragging a control in the same solution made with OpenCVSharp 4.10 onto a winform an exception is thrown. The solution builds without error.

image

Environment

Windows 10 Enterprise Build 19045. Visual Studio 2019 C# .NET Framework 4.8 AnyCPU

What did you do when you faced the problem?

I have copied the files from the dll\x86\ folder into the bin\Debug folder. I have run Dependcy walker and it shows no missing DLLS beside the API- etc ones that are not really missing Windows Media Features are installed Installed NuGet Packages for 4.10.0.20240616 OpenCVSharp4 OpenCVSharp4.Extensions OpenCVSharp4.runtime.win OpenCVSharp4.Windows OpenCVSharp4.WpfExtensions

Example code:

		private readonly int _fourcc = VideoWriter.FourCC('M', 'P', '4', 'V');

Output:

Failed to create component 'WebCamControl'. The error message follows: 'System.TypelnitializationException: The type initializer for OpenCvSharp.Internal.NativeMethods' threw an exception. ---> System.DIINotFoundException: Unable to load DLL OpenCvSharpExtern': The specified module could not be found. (Exception from HRESULT: 0x8007007E) at OpenCvSharp.Internal.NativeMethods.redirectError(CvErrorCallback errCallback, IntPtr userdata, IntPtr& prevUserdata) at OpenCvSharp.Internal.NativeMethods.LoadLibraries(IEnumerable`1 additionalPaths) at OpenCvSharp.Internal.NativeMethods..cctor() --- End of inner exception stack trace --- at OpenCvSharp.Internal.NativeMethods.videoio_VideoWriter_fourcc(SByte c1, SByte c2, SByte c3, SByte c4, Int32& returnValue) at OpenCvSharp.VideoWriter.FourCC(Char c1, Char c2, Char c3, Char (4) at WebCamDemo.WebCamControl..ctor() in WebCamControl.cs:line 35' paste your output


## What did you intend to be?
Control should be able to be moved onto a form.

jeffdavis503 avatar Oct 15 '24 21:10 jeffdavis503

I have tried all suggested fixes with no luck. I still get the exception

jeffdavis503 avatar Oct 15 '24 21:10 jeffdavis503

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '25 01:04 stale[bot]