Bug 50085 - Exceptions in PInvoke wrapper
Summary: Exceptions in PInvoke wrapper
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler ()
Version: XI 10.3 (iOS 10.2)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
Depends on:
Reported: 2016-12-15 02:20 UTC by josh.mackey
Modified: 2017-04-17 20:40 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description josh.mackey 2016-12-15 02:20:05 UTC
We do a lot of P/Invokes in our application and we're seeing these two exceptions pop up frequently but also randomly. They can appear at any of our P/Invokes.

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
  at (wrapper managed-to-native) Vpx.Native:vpxfm_encoder_encode_i420 (intptr,int,int,intptr[],int[],int[],int[],int[])

System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at (wrapper managed-to-native) Vpx.Native:vpxfm_encoder_encode_i420 (intptr,int,int,intptr[],int[],int[],int[],int[])

=== Xamarin Studio Community ===

Version 6.1.2 (build 44)
Installation UUID: 28b919d7-4cd1-42f1-940b-72355ae822e7
	Mono 4.6.2 (mono-4.6.0-branch/08fd525) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406020007

=== NuGet ===


=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 8.1 (11544)
Build 8B62

=== Xamarin.Mac ===

Version: (Xamarin Studio Community)

=== Xamarin.iOS ===

Version: (Xamarin Studio Community)
Hash: e02d272
Branch: xcode8.2
Build date: 2016-12-12 23:00:41-0500

=== Xamarin.Android ===

Version: (Xamarin Studio Community)
Android SDK: /Users/josh/Library/Android/sdk
	Supported Android versions:
		4.1 (API level 16)
		4.2 (API level 17)
		5.0 (API level 21)
		6.0 (API level 23)
		7.0 (API level 24)

SDK Tools Version: 25.2.2
SDK Platform Tools Version: 25
SDK Build Tools Version: 25

Java SDK: /usr
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Not Installed

=== Build Information ===

Release ID: 601020044
Git revision: 0ccfcd52b95305ebd5b7eca0d88c1017035910ae
Build date: 2016-10-28 15:12:43-04
Xamarin addins: a39a869d8a78d87bdc6775f696c13a4cc9024501
Build lane: monodevelop-lion-cycle8

=== Operating System ===

Mac OS X 10.12.1
Darwin Joshs-Macbook-Pro.local 16.1.0 Darwin Kernel Version 16.1.0
    Thu Oct 13 21:26:57 PDT 2016
    root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64
Comment 1 Zoltan Varga 2016-12-18 15:50:43 UTC
Do these pinvokes call back into managed code using a callback ?
Comment 2 josh.mackey 2016-12-29 01:46:07 UTC
They do. I've since figured out that those callbacks are what's throwing the exceptions. In regular .NET land, the stack trace shows that properly, whereas in mono you get the issue mentioned in the bug report.
Comment 3 Manuel de la Peña [MSFT] 2017-01-03 09:47:33 UTC
Confirmed the bug, the runtime team will decide on the approach.
Comment 4 Rodrigo Kumpera 2017-02-07 18:47:06 UTC
Please provide a test case that shows the issue.
Comment 5 Timothy Risi 2017-03-14 01:16:11 UTC

Can you provide a simple test case to reproduce the exceptions?
Comment 6 Vincent Dondain [MSFT] 2017-04-17 20:40:42 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!