Bug 29958 - Mono 4.0 - Causing 'Unexpected binary element: 0' build failure when compiling against previous mono version
Summary: Mono 4.0 - Causing 'Unexpected binary element: 0' build failure when compilin...
Status: CONFIRMED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model (show other bugs)
Version: 5.8
Hardware: Macintosh Mac OS
: Low normal
Target Milestone: ---
Assignee: Lluis Sanchez
URL:
Depends on:
Blocks:
 
Reported: 2015-05-11 18:10 UTC by alex
Modified: 2015-09-23 10:42 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 for Bug 29958 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description alex 2015-05-11 18:10:47 UTC
After updating to Mono 4.0 and Xamarin 5.9, we have encountered a 'Unexpected binary element: 0' build error when doing a build against a previous Mono version (3.12.1) with Mono 4.0 installed.

Both our legacy and new codebases report this build failure.

Tests preformed:

Without Mono 4.0 installed.
Xamarin Studio 5.8.0.443, Mono 3.12.1 - Build succeeds on both new and legacy codebases.
Xamarin Studio 5.9, Mono 3.12.1 - Build succeeds on both new and legacy codebases.

With Mono 4.0 installed.
Xamarin Studio 5.8.0.443, Mono 3.12.1 - Build fails with 'Unexpected binary element: 0' on first project for both new and legacy codebases.
Xamarin Studio 5.9, Mono 3.12.1 - Build fails with 'Unexpected binary element: 0' on first project for both new and legacy codebases.
Xamarin Studio 5.8.0.443, Mono 4 - Build succeeds on both new and legacy codebases.
Xamarin Studio 5.9, Mono 4 - Build succeeds on both new and legacy codebases.
Comment 1 Rajneesh Kumar 2015-06-18 09:54:59 UTC
I have checked this issue and able to reproduce this. To reproduce this issue I have followed the help and instruction provided in bug description.

I observed that I am getting a 'Unexpected binary element: 0' build error when doing a build against a previous Mono version (3.12.1) with Mono 4.0.x installed. Please refer the screencast given below: 

Screencast: http://www.screencast.com/t/hY0ZpOp0l

Ide Logs: https://gist.github.com/Rajneesh360Logica/6b8451ae34bfdfd6729b
Build Output: https://gist.github.com/Rajneesh360Logica/d089c586954871d9ef0c

Environment Info:

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 3.12.1 ((detached/0849ec7)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010003

=== Xamarin.Android ===

Version: 5.1.4.14 (Business Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	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)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: 8.10.2.21 (Business Edition)
Hash: 96f4a3a
Branch: master
Build date: 2015-06-12 18:49:46-0400

=== Xamarin.Mac ===

Version: 2.0.2.20 (Business Edition)

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 RobertN 2015-07-11 15:02:21 UTC
I getting the same results using any mono 3.x as the active SDK. Cmd-line building via xbuild or mcs works fine.


Building: CompilerTester (Debug|x86)
Pre-Building...
Building
---------------------- Done ----------------------
Build failed. Unexpected binary element: 0
Build: 1 error, 0 warnings

Server stack trace: 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadValue (System.IO.BinaryReader reader, System.Object parentObject, Int64 parentObjectId, System.Runtime.Serialization.SerializationInfo info, System.Type valueType, System.String fieldName, System.Reflection.MemberInfo memberInfo, System.Int32[] indices) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectContent (System.IO.BinaryReader reader, System.Runtime.Serialization.Formatters.Binary.TypeMetadata metadata, Int64 objectId, System.Object& objectInstance, System.Runtime.Serialization.SerializationInfo& info) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectInstance (System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean hasTypeInfo, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.MessageFormatter.ReadMethodCall (BinaryElement elem, System.IO.BinaryReader reader, Boolean hasHeaders, System.Runtime.Remoting.Messaging.HeaderHandler headerHandler, System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage (IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, System.IO.Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, System.IO.Stream& responseStream) [0x00000] in <filename unknown>:0 

Exception rethrown at [0]: 

  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg, System.Exception& exc, System.Object[]& out_args) [0x001e9] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs:249
Comment 3 RobertN 2015-07-11 15:05:34 UTC
XS Version 5.9.4 (build 5)

Workaround : Disable "Use MSBuild build engine..." and the project compiles without the "Unexpected binary element: 0" failure
Comment 4 Steve Perkins 2015-07-23 15:17:15 UTC
I am seeing similar behavior with Xamarin Studio 5.9.4 build 5 (the current version on the MonoDevelop website as of this comment), on Windows 8.1.

When I create a new project with the "Empty ASP.NET Project" wizard, then any option on the Build menu (build all, clean, etc) results in the "Unexpected binary element: 0" error.  This is without having added any custom code of my own... I'm simply trying to build the freshly-created hello world project generated by Xamarin Studio's own wizard template.

It does not seem to matter whether my project is configured to use latest version of Mono, or the proprietary .NET Framework runtime.  I am seeing the exact same behavior on a Windows 8.1 machine with Visual Studio 2013 installed, and on another Win 8.1 machine with VS 2015.

http://stackoverflow.com/questions/31594099/building-empty-asp-net-project-in-monodevelop-xamarin-studio-generates-unexpe