-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Failed to load OpenCvSharpExtern.dll using .NET Framework 3.5 #352
Comments
I got the same problem, in the mean time you can add an initialize an cvSVMparam = new cvSVMParam(); and use mat |
Please try to call NativeMethods.IsUnix();
var mat = new Mat(100, 100, MatType.CV_8UC1, new Scalar(0));
Cv2.ImShow("test", mat);
Cv2.WaitKey(); This is because static constructor seems not to work in .NET 3.5 or older. 😩 static class Foo
{
static Foo()
{
Console.WriteLine("static constructor");
}
[DllImport("kernel32")]
public static extern int Beep(uint dwFreq, uint dwDuration);
}
class Program
{
static void Main()
{
// "static constructor" not displayed
Foo.Beep(1000, 1000);
}
} |
The |
I found another condition. The problem occurs if P/Invoke class has I will remove SuppressUnmanagedCodeSecurity when .NET < 4.0 #if DOTNET_FRAMEWORK && !net20
[SuppressUnmanagedCodeSecurity]
#endif
static class NativeMethods
{
... |
I use OpenCvSharp3-AnyCPU 3.2.0.20170419, .NET Framework 3.5, Visual Studio 2015 on Windows 8.1 x64. Exception is thrown every time. Same code works fine using .NET Framework 4.0 and newer.
Steps to reproduce:
Actual result:
Application crashes with unhandled exception:
Expected result:
Black square image is shown
The text was updated successfully, but these errors were encountered: