x


Mono and missing types using external library

Hi,

we're trying to make use of EmguCV, which is a pure .Net library that interfaces to the native library OpenCV. We're using Unity 3.0 beta 4 for the modern Mono version.

However, when trying to create cameras for capture, we run into some missing type problems:

Unhandled Exception: System.TypeLoadException: Could not load type 
  'System.ServiceModel.ServiceBehaviorAttribute' from assembly 'Emgu.CV'.

So I locate this type in the Mono System.ServiceModel.dll, and paste the dll into our plugins directory. Then I get this:

Unhandled Exception: System.MissingMethodException: Method not found:
  'System.Security.SecurityCriticalAttribute..ctor'.

And I find this type inside mscorlib.dll, which is also in Mono. I paste this library into the Plugins directory aswell. This causes the Unity compiler to hang for a LOOOONG time, and in the end it doesn't seem to find the type anyway - still the same error message.

Any pointers and tips on how to make this work? Is it at all possible? Any idea why SecurityCriticalAttribute is missing from Unity's Mono version?

Is there a better way to resolve these issues than just pasting various DLLs into your Plugins dir to see if it works?

more ▼

asked Jul 27 '10 at 11:59 AM

Magnus Wolffelt gravatar image

Magnus Wolffelt
457 9 11 26

Will you be publishing your code (open source licence) or did you go with the commercial license?

Oct 21 '11 at 10:58 PM DaveA
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

First of all, kudos to Jens for solving this!

The problem lies in API compatibility in Player settings in the editor. It was set to .NET 2.0 reduced, instead of just .NET 2.0.

So, if you have big/complex .NET libraries that cause problems, check API compatibility settings.

Happy coding!

more ▼

answered Jul 28 '10 at 05:35 PM

Magnus Wolffelt gravatar image

Magnus Wolffelt
457 9 11 26

Thanks, worked like a charm.

Aug 11 '10 at 09:02 AM volk

isn't Emgu CV only for .NET 3.5+? how did you get this to work with Unity?

Apr 12 '12 at 03:27 PM andresp
(comments are locked)
10|3000 characters needed characters left

Sorry to bump an old thread, but I am getting the first problem you had. When I try to make a Capture object in MonoDevelop, it gives me

Unhandled Exception: System.TypeLoadException: Could not load type 

'System.ServiceModel.ServiceBehaviorAttribute' from assembly 'Emgu.CV'.

I have trued putting emgu.cv.dll, emgu.cv.ui.dll, and emgu.util in the assets/plugins folder and added them as a reference to the monodevleop project.

more ▼

answered Nov 01 '11 at 07:23 AM

goorioles747 gravatar image

goorioles747
16 2 2 2

Instead of bumping an old question, why don't you make a new one, and delete this?

Nov 01 '11 at 07:24 AM syclamoth

Because Magnus Wolffelt had the same exact problem as me, and solved it...

Nov 01 '11 at 06:35 PM goorioles747
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x231
x180
x86
x25
x6

asked: Jul 27 '10 at 11:59 AM

Seen: 10154 times

Last Updated: Apr 12 '12 at 03:27 PM