Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 14560 [details]
I have a PCL that references System.Runtime.InteropServices.ComTypes.FILETIME
When mtouch tries to link, it fails with:
/Users/fak/Dropbox/Projects/Upsight/Upsight.iOS/Upsight.fsproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets (_CompileToNative target) ->
MTOUCH: error MT2002: Failed to resolve "System.Runtime.InteropServices.ComTypes.FILETIME" reference from "System.Runtime.InteropServices, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Microsoft says this structure is available in PCLs: https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comtypes.filetime(v=vs.110).aspx
1. Create a PCL that uses FILENAME
2. Reference that PCL with an iOS app
I have attached a project that does this. But you will have to build the PCL in Visual Studio due to this bug.
=== Xamarin Studio ===
Version 5.10.1 (build 6)
Installation UUID: e51e2705-c52a-4ae8-aa07-c481d6ab8a7a
Mono 4.2.1 (explicit/6dd2d0d)
GTK+ 2.24.23 (Raleigh theme)
Package version: 402010102
=== Xamarin.Profiler ===
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Apple Developer Tools ===
Xcode 7.2 (9548)
=== Xamarin.iOS ===
Version: 188.8.131.52 (Enterprise Edition)
Build date: 2015-12-08 16:20:29-0500
=== Xamarin.Android ===
Version: 184.108.40.206 (Enterprise Edition)
Android SDK: /Users/fak/Library/Developer/Xamarin/android-sdk-mac_x86
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.4 (API level 19)
5.0 (API level 21)
6.0 (API level 23)
SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.2
Java SDK: /usr
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
=== Xamarin Android Player ===
Location: /Applications/Xamarin Android Player.app
=== Xamarin.Mac ===
Version: 220.127.116.11 (Enterprise Edition)
=== Xamarin Inspector ===
Build date: Tue Nov 17 20:54:30 UTC 2015
=== Build Information ===
Release ID: 510010006
Git revision: 0b60eecdb531933734519c13257d16a780274aab
Build date: 2015-12-04 20:28:20-05
Xamarin addins: 9876fd7c9837977178411ec7375b4352c0a0d6af
Build lane: monodevelop-lion-cycle6-baseline
=== Operating System ===
Mac OS X 10.11.2
Darwin lepton.local 15.2.0 Darwin Kernel Version 15.2.0
Fri Nov 13 19:56:56 PST 2015
Marcos / Alexander,
Could one of you work on this bug?
I get different error when using your repro project
Archive2/FiletimeLib/FiletimeLib.csproj (Build) ->
/Library/Frameworks/Mono.framework/Versions/4.2.1/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->
MyClass.cs(11,57): error CS1070: The type `System.Runtime.InteropServices.ComTypes.FILETIME' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `System.Runtime.InteropServices, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
When something is supported in PCL it does not mean it's supported by XI as every profile has different subset and XI generally does not support Com types even if they are simple structs.
I was able to make the FiletimeLib compile by switching to Profile111 which has a System.Runtime.InteropServices.dll contract (contrary to Profile259 where the struct is defined in mscorlib.dll). But of course even with that the actual app fails to compile since the forwarded type isn't there, see also Sebastien's comment in https://bugzilla.xamarin.com/show_bug.cgi?id=37632#c1.
I do wonder though whether we should add stubs that throw PlatformNotSupportedException so that the app/lib at least compiles when using the PCL? Do we have API diffs between Xamarin.iOS and the PCLs to see what is there and what isn't?
> XI generally does not support Com types even if they are simple structs.
Despite the namespace, this isn't a COM type. This type is the managed equivalent of a Win32 function struct for enumerating files.
> When something is supported in PCL it does not mean
> it's supported by XI as every profile has different subset
True. But as XI and XA claim to fulfill the contracts in Profile259 and Profile111, it seems an error on Xamarin's side whenever there is actually a hole in supporting that full profile. As this FILETIME struct is available in those profiles, XA and XI should support them.
This is showing up as blocking use of the latest version of PCLCrypto due to its dependency on PInvoke.Kernel32:
Please consider reactivating and fixing by filling in the hole in the API support. We can't fix this in PInvoke without a breaking change. But Xamarin could without one.
Alternatively, you might improve your linker to not care about the missing type since the app doesn't actually need it. It just happens to be referenced from a library that my app references, but doesn't use that part of the library.
FYI the missing typeforward was added in https://github.com/mono/mono/commit/276c31d5ed602824d2284433c9460694ed5fdda0#diff-fee27e2cd00f3fd0a43aa0e5e0bccf2dR95 recently.