Bug 20183 - Xamarin.Mac and MonoMac cannot call PCL method using Marshal
Summary: Xamarin.Mac and MonoMac cannot call PCL method using Marshal
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Other ()
Version: 1.8.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Aaron Bockover [MSFT]
Depends on:
Reported: 2014-05-30 02:56 UTC by Richard
Modified: 2014-08-27 06:12 UTC (History)
2 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 Richard 2014-05-30 02:56:57 UTC
Using Xamarin Studio 5.0 (build 878) with Xamarin.Mac, it appears that both Xamarin.Mac and MonoMac cannot call a PCL (excluding Silverlight/Windows Phone platforms, for example PCL 4.5 Profile 7) method which uses Marshal. When the method is called, a TypeLoadException is thrown:

> A System.TypeLoadException was thrown. Could not load type 'System.Runtime.InteropServices.Marshal' from assembly 'MacPCLMarshalTest.Core'.

I've attached an example solution which demos this issue.
Comment 1 Richard 2014-05-30 02:58:32 UTC
Looks like the attachment failed, here's a link instead: http://cl.ly/0u1q1q2n3n0p
Comment 2 Saurabh 2014-08-26 08:34:23 UTC
I have checked this Issue and I am unable to reproduce this Issue. Using attached project I am successfully able to run application and I am not seeing any crash.

I have checked with latest stable builds:

X.S 5.2 (Build 386)
Git revision: e6a54dee5376e6e7a2d9982695b060fddc09e65d

@Richard, Could you please check it again with latest builds?
Comment 3 Richard 2014-08-27 06:12:44 UTC
@Saurabh Thanks for the heads up, just checked the demo project again with Xamarin.Mac and looks like it works fine now. I'll mark the bug as resolved.