Created
March 21, 2014 04:37
-
-
Save brendanzagaeski/9679610 to your computer and use it in GitHub Desktop.
Xamarin.iOS does not support the System.Dynamic namespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Xamarin.iOS does not support the System.Dynamic namespace [1] | |
[1] http://docs.xamarin.com/guides/ios/advanced_topics/limitations/#No_Dynamic_Code_Generation | |
This also means that Xamarin.iOS app projects cannot use PCLs that depend on System.Dynamic. | |
## Error messages when trying to use a PCL that depends on System.Dynamic | |
### Visual Studio, without the Xamarin.iOS `System.Dynamic.Runtime` facade assembly (see also [2]) | |
> The type 'System.Dynamic.IDynamicMetaObjectProvider' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Dynamic.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. | |
> The type 'System.Dynamic.DynamicObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Dynamic.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. | |
[2] "Windows Xamarin.iOS installer is missing System.Dynamic.Runtime.dll" | |
https://bugzilla.xamarin.com/show_bug.cgi?id=18330 | |
### Visual Studio, after installing the Xamarin.iOS `System.Dynamic.Runtime` facade assembly in the facades directory [3] | |
[3] C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoTouch\v1.0\Facades | |
The build fails because the type does not exist in the facade. This is the correct behavior because the type is not available on Xamarin.iOS. | |
> Reference to type 'System.Dynamic.DynamicObject' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoTouch\v1.0\Facades\System.Dynamic.Runtime.dll', but it could not be found | |
> The base class or interface 'System.Dynamic.DynamicObject' in assembly 'System.Dynamic.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' referenced by type 'PortableClassLibrary1.Class1' could not be resolved | |
> Reference to type 'System.Dynamic.IDynamicMetaObjectProvider' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoTouch\v1.0\Facades\System.Dynamic.Runtime.dll', but it could not be found | |
> The base class or interface 'System.Dynamic.IDynamicMetaObjectProvider' in assembly 'System.Dynamic.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' referenced by type 'PortableClassLibrary1.MyMetaObjectProvider' could not be resolved | |
### Visual Studio, referencing the `System.Dynamic.Runtime` and `System.Core` assemblies from desktop .NET | |
The build fails because the desktop .NET assemblies are incompatible with Xamarin.iOS. | |
> Response status: Error | |
> error MT2001: Could not link assemblies. Reason: Argument cannot be null. | |
> Parameter name: key | |
### Visual Studio, referencing the `System.Dynamic.Runtime` and `System.Core` assemblies from desktop .NET, and disabling the linker | |
Again the build fails because the desktop .NET assemblies are incompatible with Xamarin.iOS. Since the linking step is omitted in this case, the error happens at the AOT step instead. | |
> Mono Ahead of Time compiler - compiling assembly ~/Library/Caches/Xamarin/mtbs/builds/HelloWorld1/737e127b-ece7-4094-ac93-71dce88765ad/output/temp/mtouch-cache/Build/System.Xml.dll | |
> unknown type 0x00 in type_to_regstore | |
> | |
> error MT3001: Could not AOT the assembly '~/Library/Caches/Xamarin/mtbs/builds/HelloWorld1/737e127b-ece7-4094-ac93-71dce88765ad/output/temp/mtouch-cache/Build/System.Xml.dll' | |
> error MT3001: Could not AOT the assembly '~/Library/Caches/Xamarin/mtbs/builds/HelloWorld1/737e127b-ece7-4094-ac93-71dce88765ad/output/temp/mtouch-cache/Build/System.Core.dll' | |
> error MT3001: Could not AOT the assembly '~/Library/Caches/Xamarin/mtbs/builds/HelloWorld1/737e127b-ece7-4094-ac93-71dce88765ad/output/temp/mtouch-cache/Build/System.dll' | |
### Visual Studio, referencing the `System.Dynamic.Runtime` and `System.Core` assemblies from desktop .NET, and deploying to the simulator | |
The program builds and deploys successfully, but hits an exception at run time. | |
> Unhandled Exception: | |
> System.InvalidProgramException: Invalid IL code in System.Dynamic.DynamicObject:.ctor (): method body is empty. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment