Bug 44569 - Null exception during build
Summary: Null exception during build
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 7.0 (C8)
Hardware: Macintosh Mac OS
: High normal
Target Milestone: 7.1 (C9)
Assignee: Radek Doulik
URL:
: 45559 ()
Depends on:
Blocks:
 
Reported: 2016-09-21 13:07 UTC by Paul Johnson
Modified: 2016-11-30 16:16 UTC (History)
6 users (show)

Tags:
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:
Status:
VERIFIED FIXED

Description Paul Johnson 2016-09-21 13:07:33 UTC
When building my forms app (droid target), I'm getting the following build exception. If I rebuild again, the build works, but the debugger is dead; the build produced does not reflect changes to the source. Restarting XS fixes the debugger issue

The throwback is this

/Users/PFJ/Developer/MeetingPlanner/Droid/MeetingPlanner.Droid.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_ResolveAssemblies target) ->

	/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:  warning : Failed to read '../packages/Xamarin.Android.Support.v4.23.3.0/lib/MonoAndroid403/Xamarin.Android.Support.v4.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
	/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:  warning : System.ArgumentNullException: Buffer cannot be null.
Parameter name: buffer
  at System.IO.BinaryReader.Read (System.Byte[] buffer, System.Int32 index, System.Int32 count) [0x00015] in <94fd79a3b7144c54b4cb162b50fc7761>:0 
  at Mono.Cecil.PE.ImageReader.ReadSectionData (Mono.Cecil.PE.Section section) [0x00033] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.PE.ImageReader.ReadSections (System.UInt16 count) [0x0005a] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.PE.ImageReader.ReadImage () [0x0008e] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) [0x00009] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00029] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000c] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00001] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.ReadAssembly (System.String file) [0x0004d] in <d380dac2b1c6448b9e5a58da24d6887a>:0 

Errors:

/Users/PFJ/Developer/MeetingPlanner/Droid/MeetingPlanner.Droid.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_ResolveAssemblies target) ->

	/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Exception while loading assemblies: Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA0009: Error while loading assembly: ../packages/Xamarin.Android.Support.v4.23.3.0/lib/MonoAndroid403/Xamarin.Android.Support.v4.dll ---> System.ArgumentNullException: Buffer cannot be null.
Parameter name: buffer
  at System.IO.BinaryReader.Read (System.Byte[] buffer, System.Int32 index, System.Int32 count) [0x00015] in <94fd79a3b7144c54b4cb162b50fc7761>:0 
  at Mono.Cecil.PE.ImageReader.ReadSectionData (Mono.Cecil.PE.Section section) [0x00033] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.PE.ImageReader.ReadSections (System.UInt16 count) [0x0005a] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.PE.ImageReader.ReadImage () [0x0008e] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) [0x00009] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00029] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000c] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00001] in <72833adbe6cb4f168094a4e7cb721335>:0 
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.ReadAssembly (System.String file) [0x0009c] in <d380dac2b1c6448b9e5a58da24d6887a>:0 
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Load (System.String fileName) [0x00035] in <d380dac2b1c6448b9e5a58da24d6887a>:0 
   --- End of inner exception stack trace ---
  at Java.Interop.Tools.Diagnostics.Diagnostic.Error (System.Int32 code, System.Exception innerException, System.String message, System.Object[] args) [0x0000a] in <614c479014764f1e944617b27577f29f>:0 
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Load (System.String fileName) [0x00045] in <d380dac2b1c6448b9e5a58da24d6887a>:0 
  at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x00154] in <ed6f05cfdfa24159a239bb1396141854>:0 

=== Xamarin Studio Business ===

Version 6.1 (build 5441)
Installation UUID: f3d1a29c-1ba2-4a83-a193-1087efe91a85
Runtime:
	Mono 4.6.0 (mono-4.6.0-branch/746756c) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406000245

=== NuGet ===

Version: 3.4.3.0

=== Xamarin.Profiler ===

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

=== Apple Developer Tools ===

Xcode 8.0 (11246)
Build 8A218a

=== Xamarin.iOS ===

Version: 10.0.0.6 (Xamarin Business)
Hash: 6c3fee4
Branch: xcode8
Build date: 2016-09-09 13:01:32-0400

=== Xamarin.Mac ===

Version: 2.10.0.99 (Xamarin Business)

=== Xamarin.Android ===

Version: 7.0.0.18 (Xamarin Business)
Android SDK: /Users/PFJ/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)
		7.0    (API level 24)

SDK Tools Version: 25.2.2
SDK Platform Tools Version: 24.0.3
SDK Build Tools Version: 24.0.1

Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

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

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Build Information ===

Release ID: 601005441
Git revision: 68292d1ab289911c815ddc715dd7cc29a9752f9f
Build date: 2016-09-09 04:43:23-04
Xamarin addins: ed25d008672663eeb9db55f1ccecb3c24d2fd3b2
Build lane: monodevelop-lion-cycle8

=== Operating System ===

Mac OS X 10.12.0
Darwin Pauls-iMac.local 16.0.0 Darwin Kernel Version 16.0.0
    Mon Aug 29 17:56:20 PDT 2016
    root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64
Comment 1 David Karlaš 2016-11-04 09:16:28 UTC
*** Bug 45559 has been marked as a duplicate of this bug. ***
Comment 2 Paul Johnson 2016-11-04 10:44:55 UTC
This bug is in the current release (Xcode 8.1 update) too
Comment 3 Dan Ardelean 2016-11-04 13:56:54 UTC
Yes it is not only Android also iOS. Here is the build log:
https://1drv.ms/t/s!AuJWJQUKZPJorotCvYrcRNOMq_G-0Q

It happens a lot and it really kills productivity in XS :(

Dan
Comment 4 Radek Doulik 2016-11-14 17:53:30 UTC
Paul, could you please attach your project (or simplified version) so that we can reproduce the issue?
Comment 5 Dan Ardelean 2016-11-14 17:59:28 UTC
I think you can try with any Xamarin.Forms project. At some point it just breaks. It is not consistent but when it breaks we need to restart Xamarin Studio
Comment 6 Radek Doulik 2016-11-29 21:01:38 UTC
Greg, do you know if that might be a XS bug? Does it ring a bell?

I have checked the cecil code and the part where it crashes is removed, so chances are it will be fixed in the next release.

Might be build process out of memory issue. The newer cecil has improved memory usage.
Comment 7 Greg Munn 2016-11-29 21:48:24 UTC
Sorry Radek, I don't know if it's an XS bug. maybe it's an msbuild/xbuild bug but I can't say. Ankit might know more.
Comment 8 Paul Johnson 2016-11-29 22:48:29 UTC
It also seems to have gone with the current version released.
Comment 9 Radek Doulik 2016-11-30 10:13:11 UTC
That's good news, thanks for reporting. I guess it is fixed in the Xamarin.Android.7.1.0.9 then.
Comment 10 Naqeeb 2016-11-30 16:16:45 UTC
As per comment 8 and comment 9 this issue fixed for Paul. Hence closing this issue.