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.
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.
Do you have 'Enable Incremental Builds' enabled in project options ? If yes, does disabling it and recompiling fixes the problem ?
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.
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 :-$
@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!
Just for info: had the same problem until I referenced System.ComponentModel.DataAnnotations directly in the Xamarin.IOS-Project.