Bug 33351 - mdtool randomly fails to build the app from command line
Summary: mdtool randomly fails to build the app from command line
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 5.1
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-08-25 02:32 UTC by Prashant Cholachagudda
Modified: 2015-11-23 17:17 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:
RESOLVED ANSWERED

Description Prashant Cholachagudda 2015-08-25 02:32:36 UTC
/Applications/Xamarin Studio.app/Contents/MacOS/mdtool build -c:Release -t:SignAndroidPackage -p:Faithlife.ReaderApp.LogosBible.Android
Xamarin Studio Build Tool
Loading solution: /Volumes/Compile/Jenkins/workspace/MobileReader-Master/MobileReader/DigitalLibrary-Mobile.sln
Loading solution: /Volumes/Compile/Jenkins/workspace/MobileReader-Master/MobileReader/DigitalLibrary-Mobile.sln
Loading projects ..
Stacktrace:

at <unknown> <0xffffffff>
at System.Security.Cryptography.X509Certificates.X509ChainStatus..ctor (System.Security.Cryptography.X509Certificates.X509ChainStatusFlags) [0x00007] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/System/System.Security.Cryptography.X509Certificates/X509ChainStatus.cs:42
at System.Security.Cryptography.X509Certificates.X509Chain.Build (System.Security.Cryptography.X509Certificates.X509Certificate2) [0x000cc] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs:140
at System.Net.ServicePointManager/ChainValidationHelper.ValidateChain (Mono.Security.X509.X509CertificateCollection) [0x0009f] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/System/System.Net/ServicePointManager.cs:457
at Mono.Security.Protocol.Tls.SslClientStream.OnRemoteCertificateValidation2 (Mono.Security.X509.X509CertificateCollection) [0x0000d] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:634
at Mono.Security.Protocol.Tls.SslStreamBase.RaiseRemoteCertificateValidation2 (Mono.Security.X509.X509CertificateCollection) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:208
at Mono.Security.Protocol.Tls.SslClientStream.RaiseServerCertificateValidation2 (Mono.Security.X509.X509CertificateCollection) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:657
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.RemoteValidation (Mono.Security.Protocol.Tls.ClientContext,Mono.Security.Protocol.Tls.AlertDescription) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs:204
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection) [0x0001f] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs:196
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00054] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs:105
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00037] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs:105
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () <IL 0x00038, 0xffffffff>
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream) [0x00039] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs:81
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (System.IAsyncResult) [0x00117] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:396
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <IL 0x00062, 0xffffffff>

Native stacktrace:


Debug info from gdb:

(lldb) command source -s 1 '/tmp/mono-gdb-commands.Bz9Htw'
warning: (i386) /Library/Frameworks/Mono.framework/Versions/4.0.1/lib/libglib-2.0.0.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
warning: (i386) /Library/Frameworks/Mono.framework/Versions/4.0.1/lib/libintl.8.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 74657 detached
(lldb)
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================


# Version information
=== Xamarin Studio ===

Version 5.9.3 (build 1)
Installation UUID: ed34e891-c6f4-4f74-943f-ffde8b9c13b1
Runtime:
Mono 4.0.1 ((detached/ed1d3ec)
GTK+ 2.24.23 (Raleigh theme)

Package version: 400010044

=== Apple Developer Tools ===

Xcode 6.3.2 (7718)
Build 6D2105

=== Xamarin.iOS ===

Version: 8.10.3.2 (Business Edition)
Hash: 8b265d6
Branch: master
Build date: 2015-06-30 15:19:13-0400

=== Xamarin.Android ===

Version: 5.1.2.0 (Business Edition)
Android SDK: /Users/ccservice/Library/Developer/Xamarin/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.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 509030001
Git revision: 5a524e1726ed103fdd4fe37e0356f2b35466ce9d
Build date: 2015-06-02 16:35:08-04
Xamarin addins: 51957cfbd06be911b212671ad05c2c6221ac90f9

=== Operating System ===

Mac OS X 10.10.3
Darwin build-mac-06.lrscorp.net 14.3.0 Darwin Kernel Version 14.3.0
Mon Mar 23 11:59:05 PDT 2015
root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 1 Prashant Cholachagudda 2015-08-25 02:34:36 UTC
Created attachment 12626 [details]
full build output
Comment 2 Rajneesh Kumar 2015-08-25 12:41:06 UTC
I tried to reproduce this issue but notable to reproduce this. To reproduce this issue I have followed the steps and instruction provided in bug description. Please have a look on the screencast given below:

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

Could you please let me know that what steps I am missing/wrong to reproduce this issue ? and I am using following command to build the application.

/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool build -c:Release  /Users/MM/Projects/Bug_33351/Bug_33351.sln

Build Output: https://gist.github.com/Rajneesh360Logica/85892e2337c4e3d5d10e

Environment Info:

=== Xamarin Studio ===

Version 5.9.5 (build 10)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

=== Xamarin.Android ===

Version: 5.1.5.3 (Enterprise 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)
		5.1    (API level 22)
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.4.46 (Business Edition)
Hash: 2c66d2f
Branch: master
Build date: 2015-08-04 13:52:25-0400

=== Xamarin.Mac ===

Version: 2.0.2.111 (Business Edition)

=== Build Information ===

Release ID: 509050010
Git revision: 48d16bc4f12ce3938964fc7c3d72fdc6887ad4ad
Build date: 2015-08-18 16:55:24-04
Xamarin addins: c2d51b360ad9f59e689046d47030df27de28f94a

=== 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 3 Dave Dunkin 2015-08-25 12:47:13 UTC
It is an intermittent issue. We started seeing it frequently in the last few days.
Comment 4 Jonathan Pryor 2015-08-25 13:35:35 UTC
I would suggest using xbuild instead of md-tool.
Comment 5 Dave Dunkin 2015-09-23 13:48:04 UTC
We can't use xbuild because, as far as I can tell it doesn't support:
1. executing a target in project using a solution configuration (https://msdn.microsoft.com/en-us/library/ms171486.aspx)
2. building a project with references to other projects without the same configuration
Comment 6 Alan McGovern 2015-11-12 14:29:25 UTC
The most likely thing to fix this issue is upgrading mono to 4.2 or newer. This is an issue we encountered and patched a while ago, but the fix may not have made it into the 4.0 series.

I'm not sure if xbuild supports the syntax you've described in your first point, but it can build slns and does support executing a specific target.

The second point is definitely supported though. 'sln' files store the configuration mappings for each project, so you can set each project to whatever configuration you need and then tell xbuild to build the sln.
Comment 7 Mikayla Hutchinson [MSFT] 2015-11-12 18:00:36 UTC
@alan If you build an individual project (xbuild foo.csproj) it won't respect the solution configuration mappings (it doesn't know where the solution is) when resolving/building project references. And if you build a solution, you can only build the Build, Rebuild and Clean targets.

I can think of a workaround though.

Put this in your csproj file AFTER the common targets:

<PropertyGroup Condition="'$(RunTargets)' !='' And '$(InProject)'=='$(ProjectName)'">
    <BuildDependsOn>$(RunTargets)<BuildDependsOn>
<PropertyGroup>

Then you can do:

msbuild foo.sln /p:RunTargets=RunTargets /p:InProject=Foo