Bug 37632 - System.Runtime.InteropServices.Marshal.GetNativeVariantForObject missing
Summary: System.Runtime.InteropServices.Marshal.GetNativeVariantForObject missing
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries ()
Version: XI 9.4 (iOS 9.2)
Hardware: Macintosh Mac OS
: --- major
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2016-01-12 21:18 UTC by Frank A. Krueger
Modified: 2016-11-30 19:24 UTC (History)
4 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:

Comment 1 Sebastien Pouliot 2016-01-13 03:46:43 UTC
COM features are disabled in mono runtime used in Xamarin.iOS [1]. 

The related API are not shipped in the BCL provided by XI (most of them would not work and several are not implemented in mono).

[1] http://developer.xamarin.com/guides/ios/advanced_topics/limitations/

What's the use case ? the method is only 3 lines if you want to use this outside of a a COM context.
Comment 2 Sebastien Pouliot 2016-04-12 15:56:09 UTC
We have not received further information and will assume this is not an issue anymore. If you can still affected by this please re-open the bug and include the requested information. Thanks.
Comment 3 Frank A. Krueger 2016-11-29 20:11:46 UTC
This is very much still an issue. The API is declared in a PCL profile Xamarin supports so it should be there.

The problem is that the Roslyn compiler references this function. Currently, I have to butcher the Roslyn compiler to make it work on Xamarin.
Comment 4 Frank A. Krueger 2016-11-29 20:13:08 UTC
Please see this discussion from the Roslyn team - they say this is Xamarin's problem: https://github.com/dotnet/roslyn/pull/7915#discussion-diff-49557085
Comment 5 Sebastien Pouliot 2016-11-29 21:35:22 UTC
This is already fixed as part of the netstandard 2.0 compliance work and you should already have the API (which throws a `PlatformNotSupportedException`) if you're using XI 10.0+ [1]

[1] https://developer.xamarin.com/releases/ios/api_changes/ios_9.8.2_to_10.0.0/
Comment 6 Frank A. Krueger 2016-11-30 19:24:38 UTC
Ah the magic of .NET Standard. Thanks!