1

I have a very basic C# .NET Core 2.0 application which uses a couple of very basic features of OpenCV as a proof of concept.

I'm trying to run this in a nanoserver container, eventually to be deployed as an IoT Edge module, but I get an error saying that it cannot locate a DLL file.

Unhandled Exception: System.TypeInitializationException: The type initializer for 'OpenCvSharp.NativeMethods' threw an exception. --->
System.DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I have tried compiling with just dotnet publish IoTCoreCSharp.csproj and with dotnet publish IoTCoreCSharp.csproj --runtime win10-x64 --configuration Debug --force, both without luck.

My Docker file looks like this:

FROM microsoft/dotnet:2.0.0-runtime-nanoserver-1709

ARG EXE_DIR=.

WORKDIR /app

COPY $EXE_DIR/ ./

COPY system32_opencvsharp_deps/ C:/Windows/System32

CMD ["dotnet" "IoTCoreCSharp.dll"]

system32_opencvsharp_deps contains avicap32.dll, avifil32.dll, msacm32.dll, msvfw32.dll, and vcruntime140.dll. OpenCvSharpExtern.dll is located in the root of the directory of the DLL file we're executing.

The program runs in a windowsservercore-based image with .NET installed on it perfectly on my development machine, but this kind of image does not run on Windows 10 IoT Core which we need.

Error when trying to run on IoT Core:

c:\Program Files\docker\docker.exe: Error response from daemon: container
e9da3baa806f161153fdb7f60a9401a5ff46c32a959499cbe0bd822b1fc0dda3 encountered an error during Start: failure in a
Windows system call: The compute system exited unexpectedly. (0xc0370106).
Community
  • 1
  • 1
Hammatt
  • 71
  • 2
  • 7
  • Does your code work in server core image? – Gregory Suvalian Apr 16 '18 at 00:21
  • @GregorySuvalian Is there a server core based dotnet image for me to try? – Hammatt Apr 16 '18 at 00:44
  • There is none but you can just with based servercore image and install dotnet core on it (https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script) – Gregory Suvalian Apr 16 '18 at 11:56
  • I'm trying to create a new image based off windowsservercore to check if that works but it's taking a very long time to download, I'll report back when it does something. Thanks. – Hammatt Apr 16 '18 at 23:40
  • Yes, it does work in a windowsservercore image. But windowsserver core does not run on windows 10 iot core. – Hammatt Apr 18 '18 at 01:07

1 Answers1

0

You can refer to this sample. This sample shows how to run OpenCVSharp in a Windows container with microsoft/dotnet-framework:4.7.1-windowsservercore-1709 as the base image. It indicates the same problem you encountered.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Michael Xu
  • 4,382
  • 1
  • 8
  • 16
  • Thanks, I have already looked at that and this type of image does not run on windows 10 iot core, only nanoserver does. Error when trying to run a windowsservercore image on windows 10 iot core: c:\Program Files\docker\docker.exe: Error response from daemon: container e9da3baa806f161153fdb7f60a9401a5ff46c32a959499cbe0bd822b1fc0dda3 encountered an error during Start: failure in a Windows system call: The compute system exited unexpectedly. (0xc0370106). – Hammatt Apr 18 '18 at 01:07
  • @Hammatt,what is your board,is it a Minnowboard Turbot?Windows IoT Core supports Azure IoT Edge only on Intel x64-based processors. – Michael Xu Apr 18 '18 at 06:22
  • We have multiple Windows 10 IoT Core boards, all of which are intel x64-based. we do have some Minnowboard Turbot and I have tested specifically on that one and got the same result. we are successfully running other iot edge modules on all of our boards. the problem is that it does not support windowsservercore based containers, only nanoserver is supported, as far as I'm aware. – Hammatt Apr 18 '18 at 20:04