Bug 57258 - System.InvalidOperationException: PE image does not have metadata when building for Android
Summary: System.InvalidOperationException: PE image does not have metadata when buildi...
Status: RESOLVED NORESPONSE
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-06-07 22:13 UTC by James Moore
Modified: 2017-10-13 17:45 UTC (History)
3 users (show)

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


Attachments
build output (3.91 MB, text/plain)
2017-06-07 22:25 UTC, James Moore
Details
VSfM log directory (30.09 KB, application/octet-stream)
2017-06-07 23:18 UTC, James Moore
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 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:
Status:
RESOLVED NORESPONSE

Description James Moore 2017-06-07 22:13:32 UTC
Got:

/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018: The "ResolveAssemblyReference" task failed unexpectedly.
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018: System.InvalidOperationException: PE image does not have metadata.
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at System.Reflection.PortableExecutable.PEReader.GetMetadataBlock () [0x0000d] in <80d8aec34fdc475e84fe2539997a17cf>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at System.Reflection.PortableExecutable.PEReader.GetMetadata () [0x00000] in <80d8aec34fdc475e84fe2539997a17cf>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at System.Reflection.Metadata.PEReaderExtensions.GetMetadataReader (System.Reflection.PortableExecutable.PEReader peReader, System.Reflection.Metadata.MetadataReaderOptions options, System.Reflection.Metadata.MetadataStringDecoder utf8Decoder) [0x0000e] in <80d8aec34fdc475e84fe2539997a17cf>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at System.Reflection.Metadata.PEReaderExtensions.GetMetadataReader (System.Reflection.PortableExecutable.PEReader peReader) [0x00000] in <80d8aec34fdc475e84fe2539997a17cf>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at Microsoft.Build.Shared.AssemblyNameExtension.GetAssemblyNameEx (System.String path) [0x00010] in <af0cfccf10514b3b89a7b505261aee9a>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at Microsoft.Build.Tasks.SystemState.GetAssemblyName (System.String path) [0x0007f] in <af0cfccf10514b3b89a7b505261aee9a>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at Microsoft.Build.Tasks.ReferenceTable.SetPrimaryAssemblyReferenceItem (Microsoft.Build.Framework.ITaskItem referenceAssemblyName) [0x001cb] in <af0cfccf10514b3b89a7b505261aee9a>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at Microsoft.Build.Tasks.ReferenceTable.SetPrimaryItems (Microsoft.Build.Framework.ITaskItem[] referenceAssemblyFiles, Microsoft.Build.Framework.ITaskItem[] referenceAssemblyNames, System.Collections.ArrayList exceptions) [0x00021] in <af0cfccf10514b3b89a7b505261aee9a>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at Microsoft.Build.Tasks.ReferenceTable.ComputeClosure (Microsoft.Build.Tasks.DependentAssembly[] remappedAssembliesValue, Microsoft.Build.Framework.ITaskItem[] referenceAssemblyFiles, Microsoft.Build.Framework.ITaskItem[] referenceAssemblyNames, System.Collections.ArrayList exceptions) [0x00012] in <af0cfccf10514b3b89a7b505261aee9a>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute (Microsoft.Build.Shared.FileExists fileExists, Microsoft.Build.Shared.DirectoryExists directoryExists, Microsoft.Build.Tasks.GetDirectories getDirectories, Microsoft.Build.Tasks.GetAssemblyName getAssemblyName, Microsoft.Build.Tasks.GetAssemblyMetadata getAssemblyMetadata, Microsoft.Build.Shared.GetRegistrySubKeyNames getRegistrySubKeyNames, Microsoft.Build.Shared.GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, Microsoft.Build.Tasks.GetLastWriteTime getLastWriteTime, Microsoft.Build.Tasks.GetAssemblyRuntimeVersion getRuntimeVersion, Microsoft.Build.Shared.OpenBaseKey openBaseKey, Microsoft.Build.Tasks.GetAssemblyPathInGac getAssemblyPathInGac, Microsoft.Build.Tasks.IsWinMDFile isWinMDFile, Microsoft.Build.Tasks.ReadMachineTypeFromPEHeader readMachineTypeFromPEHeader) [0x00556] in <af0cfccf10514b3b89a7b505261aee9a>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute () [0x00000] in <af0cfccf10514b3b89a7b505261aee9a>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in <17cf0d85abb54c3386b1d29b84d24278>:0 
/Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(1980,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder+<ExecuteInstantiatedTask>d__26.MoveNext () [0x00249] in <17cf0d85abb54c3386b1d29b84d24278>:0 
    0 Warning(s)
    1 Error(s)



I'll include full output and logs as attachments.
Comment 1 James Moore 2017-06-07 22:14:11 UTC
=== Visual Studio Community 2017 for Mac (Preview) ===

Version 7.1 Preview (7.1 build 583)
Installation UUID: 54529aae-a4b8-4338-92ef-3daa15673f67
Runtime:
	Mono 5.2.0.104 (2017-04/4a0006f) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 502000104

=== NuGet ===

Version: 4.0.0.2323

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
SDK: /usr/local/share/dotnet/sdk/1.0.0-preview2-003121/Sdks
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.2 (12175)
Build 8E2002

=== Xamarin.Android ===

Version: 7.3.1.2 (Visual Studio Community)
Android SDK: /Users/james/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		5.0 (API level 21)
		7.1 (API level 25)

SDK Tools Version: 26.0.2
SDK Platform Tools Version: 26.0.0 rc2
SDK Build Tools Version: 26.0.0 rc2

Java SDK: /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin.iOS ===

Version: 10.11.0.126 (Visual Studio Community)
Hash: 7571635e
Branch: master
Build date: 2017-05-09 16:04:54-0400

=== Xamarin.Mac ===

Version: 3.5.0.126 (Visual Studio Community)

=== Xamarin Inspector ===

Version: 1.3.0-alpha2
Hash: fa030e0
Branch: master
Build date: Thu, 01 Jun 2017 20:55:26 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 701000583
Git revision: 445a7f09feca58babb966e0c66a6b299d0bd450c
Build date: 2017-05-12 16:05:38-04
Xamarin addins: f9b72ca5f6ca5d9476d8f58353ada2afd56c549b
Build lane: monodevelop-lion-d15-3-preview

=== Operating System ===

Mac OS X 10.12.5
Darwin 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Macaque Tips 0.1.2
Comment 2 James Moore 2017-06-07 22:24:51 UTC
I realized I wasn't logged in with our regular license. Logged in, got same error.
Comment 3 James Moore 2017-06-07 22:25:32 UTC
Created attachment 22756 [details]
build output
Comment 4 James Moore 2017-06-07 23:18:17 UTC
Created attachment 22759 [details]
VSfM log directory
Comment 5 Jon Douglas [MSFT] 2017-06-23 16:58:57 UTC
Thank you for taking the time to submit the bug. We are unable to reproduce this issue. Although this issue looks to be in msbuild, it also seems like you're using a Preview version of VS4Mac. Do you have a reproduction project that you can upload to this bug report for one of us to confirm the behavior? A couple of things you should get in the time being:

1) Install a non-preview of VS4Mac:

Such as:

Version 7.0.1 (build 24)

https://www.visualstudio.com/en-us/news/releasenotes/vs2017-mac-relnotes

2) Get only the Android Build diagnostic Output (You do not need to build the whole solution, but rather just the Android one)
Comment 6 James Moore 2017-06-27 16:16:59 UTC
I didn't realize there were non-preview versions of VSfM available, I'll give it a shot.  (Although I have to say I find the use of the word "preview" to be really weird; the update system knows about alpha, beta, and stable, but preview isn't a thing.)

Shared the project via google drive.
Comment 7 Jon Douglas [MSFT] 2017-08-21 21:10:18 UTC
(In reply to James Moore from comment #6)
> I didn't realize there were non-preview versions of VSfM available, I'll
> give it a shot.  (Although I have to say I find the use of the word
> "preview" to be really weird; the update system knows about alpha, beta, and
> stable, but preview isn't a thing.)
> 
> Shared the project via google drive.

I do not see a project or google drive link in this bugzilla. Can you please look over this and advise? Thank you!
Comment 8 Jon Douglas [MSFT] 2017-10-13 17:45:09 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!