Bug 52739 - [iOS cycle9] Could not AOT the assembly System.ComponentModel.DataAnnotations.dll on iOS device
Summary: [iOS cycle9] Could not AOT the assembly System.ComponentModel.DataAnnotations...
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler ()
Version: XI 10.4 (C9)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
Depends on:
Reported: 2017-02-24 12:21 UTC by Jason Brown
Modified: 2017-06-27 18:27 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:

Description Jason Brown 2017-02-24 12:21:11 UTC
I get the error:-

4>  Cannot open assembly '/Users/...96d9fc/obj/iPhone/Debug/mtouch-cache/64/Build/System.ComponentModel.DataAnnotations.dll': File does not contain a valid CIL image.
4>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(700,3): error : Could not AOT the assembly '/Users/...96d9fc/obj/iPhone/Debug/mtouch-cache/64/Build/System.ComponentModel.DataAnnotations.dll'

When trying to run on an iPhone. The build works fine for the simulator.
Comment 1 Zoltan Varga 2017-02-24 21:44:26 UTC
Do you have 'Enable Incremental Builds' enabled in project options ? If yes, does disabling it and recompiling fixes the problem ?
Comment 2 Sebastien Pouliot 2017-02-24 22:08:21 UTC
Our unit tests for System.ComponentModel.DataAnnotations.dll runs fine on devices.

If possible please attach a test case that we can use to duplicate the issue.

If not then attach a full build log (with additional `-v -v -v -v` given to mtouch) so we can see more details about your build and its options.
Comment 3 Jason Brown 2017-02-27 08:56:54 UTC
I think it was because I was referencing the wrong .dll

If I reference:-

C:\Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Libraries\Client\System.ComponentModel.DataAnnotations.dll

...then it works OK.

I will mark this as RESOLVED INVALID - and sorry for wasting your time :-$


Comment 4 Sebastien Pouliot 2017-02-27 15:30:44 UTC
@Jason the XI SDK ships it's own System.ComponentModel.DataAnnotations.dll assembly

This is the one being tested and, to avoid hard to reproduce issues, the one you should be using inside your application.

If you had issue with our (XI) version then please re-open the bug along with a test case so we can investigate. Thanks!
Comment 5 Sascha Schwegelbauer 2017-06-27 18:27:28 UTC
Just for info: had the same problem until I referenced System.ComponentModel.DataAnnotations directly in the Xamarin.IOS-Project.