Bug 41878 - iOS build error - Microsoft.Win32.Primitives.dll incorrect format
Summary: iOS build error - Microsoft.Win32.Primitives.dll incorrect format
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.1.0 (C7)
Hardware: PC Windows
: Normal normal
Target Milestone: Future Cycle
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-06-16 02:54 UTC by dbrevitt
Modified: 2017-09-15 06:52 UTC (History)
5 users (show)

Tags: BZSRC7
Is this bug a regression?: ---
Last known good build:


Attachments
SGen Error (20.00 KB, text/plain)
2016-06-19 00:33 UTC, dbrevitt
Details


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 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:
Status:
RESOLVED NOT_REPRODUCIBLE

Description dbrevitt 2016-06-16 02:54:05 UTC
# Steps to reproduce
Upgrade using Xamarin.VisualStudio_4.1.0.530.msi

# Expected behavior
iOS project compiles

# Actual behavior
iOS project fails to compile with error: 

An attempt was made to load an assembly with an incorrect format: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\Microsoft.Win32.Primitives.dll

# Supplemental info (logs, images, videos)


# Test environment (full version information)

Microsoft Visual Studio Enterprise 2015
Version 14.0.25123.00 Update 2
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA436
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015   00322-80000-00000-AA436
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA436
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA436
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - ENU   00322-80000-00000-AA436
Windows Phone SDK 8.0 - ENU

ASP.NET and Web Tools 2015 (RC1 Update 1)   14.1.20203.0
ASP.NET and Web Tools 2015 (RC1 Update 1)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Azure App Service Tools v2.8.2   14.0.20201.0
Azure App Service Tools v2.8.2

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.0.6000.0
Microsoft Azure Data Lake Tools for Visual Studio

Common Azure Tools   1.7
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

DataFactoryProject   1.0
Microsoft Data Factory Package

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JetBrains ReSharper Ultimate 10.0.2   Build 104.0.20151218.120627
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2016 JetBrains, Inc.

Microsoft Azure Data Factory Node Node   1.0
Azure Data Factory extension for Visual Studio Server Explorer.

Microsoft Azure HDInsight HQL Service   2.0.6000.0
Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio   2.0.6000.0
An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.8
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.8.40211.2

NuGet Package Manager   3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.60311.1
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript   1.8.31.0
TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25219.00
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VisualSVN   5.1.3
Integration with Subversion version control. For more information about VisualSVN, see the VisualSVN website at http://www.visualsvn.com
Copyright © 2005-2015 VisualSVN Ltd. All rights reserved.

VsPackage Extension   1.0
VsPackage Visual Studio Extension Detailed Info

Xamarin   4.1.0.530 (2e39740)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.1.0.71 (4e27558)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   9.8.0.323 (39ebb77)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Ben Beckley 2016-06-16 15:55:06 UTC
Hello,

Could you please provide a diagnostic build output of the failure? This can be enabled through "Tools > Options > Projects and Solutions > Build and Run" and then changing the build verbosity to diagnostic.
Comment 2 dbrevitt 2016-06-19 00:33:13 UTC
Created attachment 16400 [details]
SGen Error

Attached relevant log section. Full log is large. Let me know if you want the rest of it.

Notes:
- issue occurs after running Xamarin.VisualStudio_4.1.0.530.msi
- issue does not occur after downgrading to Xamarin.VisualStudio_4.0.4.4.msi
- seems related to x86 vs x64 sgen?
- Our iOS project has 'Generate serialization assembly' set to 'Auto'. The issue can be prevented by setting 'Generate serialization assembly' to 'Off'. 

I can live with this workaround for debugging via Visual Studio. And I can leave this setting set to 'Auto' for Release builds which run on Mac build server and don't encounter the issue.
Comment 3 Daniel Cazzulino 2016-06-19 04:57:00 UTC
Decreasing the severity since it has an easy workaround.

We will investigate further why this started happening in 4.1.x.

Thanks for reporting!
Comment 6 Prashant [MSFT] 2017-09-15 06:52:49 UTC
Thanks so much for taking the time to submit this report! 

I attempted to reproduce this issue based on the bug description with the latest Visual Studio 2015 Update 3, and I was unable to hit the problem. If this issue is still occurring for you, please reopen this report and attach a reproduction, ideally starting with a new template project and then adding just the code necessary to demonstrate the issue.

# Version information

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA930
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015   00322-80000-00000-AA930
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA930
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA930
Microsoft Visual C++ 2015

Visual F# 2015   00322-80000-00000-AA930
Microsoft Visual F# 2015

Application Insights Tools for Visual Studio Package   7.0.20622.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11107.0
ASP.NET and Web Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Mono Debugging for Visual Studio   4.7.4-pre (c2d89eb)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript   1.8.36.0
TypeScript tools for Visual Studio

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   4.7.0.934 (d68a92f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.5.0.15 (cf95324)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.14.0.26 (416f778)
Visual Studio extension to enable development for Xamarin.iOS.