Bug 60540 - ToDo.iOS failed to build with error Mono.CompilerServices.SymbolWriter.MonoSymbolFileException: Symbol file `/data/jenkins/workspace/XI/xisamplebuilding-mono-2017-10/xamarin-forms-samples/Todo/packages/sqlite-net-pcl.1.3.3/lib/netstandard1.1
Summary: ToDo.iOS failed to build with error Mono.CompilerServices.SymbolWriter.MonoSy...
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: XI 11.4 (d15-5)
Hardware: PC Mac OS
: High blocker
Target Milestone: 15.6
Assignee: Chris Hamons
URL:
: 60572 ()
Depends on:
Blocks:
 
Reported: 2017-11-06 20:02 UTC by GouriKumari
Modified: 2018-01-05 09:47 UTC (History)
8 users (show)

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


Attachments
build.log (2.87 MB, text/plain)
2017-11-08 16:35 UTC, Manuel de la Peña [MSFT]
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:
VERIFIED FIXED

Description GouriKumari 2017-11-06 20:02:56 UTC
## Steps to reproduce:
Update System to Xamarin.iOS macios-mono-2017-10 build, Version: 11.5.0.216 (Visual Studio Enterprise)
Hash: 3b4764c5.
Mono 5.8.0.37 (2017-10/56195c0cb36) (64-bit)
Build https://github.com/xamarin/xamarin-forms-samples/tree/master/Todo

## ActuaL Behaviour:
Sample fails to build with error:
A full rebuild has been forced because the cache for TodoiOS is not valid.
   MTOUCH: error MT0009: Error while loading assemblies: /data/jenkins/workspace/XI/xisamplebuilding-mono-2017-10/xamarin-forms-samples/Todo/packages/sqlite-net-pcl.1.3.3/lib/netstandard1.1/SQLite-net.dll
   		--- inner exception
   		Mono.CompilerServices.SymbolWriter.MonoSymbolFileException: Symbol file `/data/jenkins/workspace/XI/xisamplebuilding-mono-2017-10/xamarin-forms-samples/Todo/packages/sqlite-net-pcl.1.3.3/lib/netstandard1.1/SQLite-net.dll.mdb' does not match assembly

## Logs:
Build Log: 
https://gist.github.com/GouriKumari/6b395bee5ce26c4d08e0cf07831c4cc6

## test Env:
=== Visual Studio Enterprise 2017 for Mac ===

Version 7.2.2 (build 7)
Installation UUID: 74c37335-5878-4fa7-8f71-09bc48b661c5
Runtime:
	Mono 5.8.0.37 (2017-10/56195c0cb36) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 508000037

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	2.0.0
	1.1.1
	1.0.4
SDK: /usr/local/share/dotnet/sdk/2.0.0/Sdks
SDK Versions:
	2.0.0
	1.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

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

=== Apple Developer Tools ===

Xcode 9.0 (13247)
Build 9A235

=== Xamarin.iOS ===

Version: 11.5.0.216 (Visual Studio Enterprise)
Hash: 3b4764c5
Branch: master
Build date: 2017-11-02 20:30:03-0400

=== Xamarin.Android ===

Version: 8.0.2.1 (Visual Studio Enterprise)
Android SDK: /Users/gourikumari/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		6.0 (API level 23)

SDK Tools Version: 25.2.3
SDK Platform Tools Version: 25.0.1
SDK Build Tools Version: 25.0.1

Java SDK: /usr
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

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

=== Xamarin Inspector ===

Version: 1.3.2
Hash: 461f09a
Branch: 1.3-release
Build date: Tue, 03 Oct 2017 18:26:57 GMT
Client compatibility: 1

=== Xamarin.Mac ===

Version: 3.8.1.0 (Visual Studio Enterprise)

=== Build Information ===

Release ID: 702020007
Git revision: 2236098c68f51eeb447cb947a87371d1e84f6213
Build date: 2017-10-23 11:43:05-04
Xamarin addins: eaa605cf97f25ce184949f32c712b465ca96f665
Build lane: monodevelop-lion-d15-4

=== Operating System ===

Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Gist Ide Information 1.1.0
Internet of Things (IoT) development (Preview) 7.1
Comment 1 Manuel de la Peña [MSFT] 2017-11-08 16:35:43 UTC
Created attachment 25607 [details]
build.log

Tested and confirmed the error (attached build.log) with the following env: 

Tested the sample with the following env:

=== Visual Studio Community 2017 for Mac (Preview) ===

Version Preview - Internal Dogfood (7.3 build 763)
Installation UUID: 8d12e55e-3489-463f-ac52-8cb4573c5a81
Runtime:
	Mono 5.4.1.6 (2017-06/1f4613aa1ac) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 504010006

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

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

=== Xamarin.Profiler ===

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

=== Apple Developer Tools ===

Xcode 9.1 (13532)
Build 9B55

=== Xamarin.iOS ===

Version: 11.5.0.202 (Visual Studio Community)
Hash: 0faf7213
Branch: mono-2017-10
Build date: 2017-11-08 16:56:01+0100

=== Xamarin.Android ===

Version: 8.0.2.1 (Visual Studio Community)
Android SDK: /Users/mandel/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		6.0   (API level 23)
		7.1   (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.4
SDK Build Tools Version: 25.0.1

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

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

=== Xamarin.Mac ===

Version: 4.1.0.217 (Visual Studio Community)

=== Xamarin Inspector ===

Version: 1.3.2
Hash: 461f09a
Branch: 1.3-release
Build date: Tue, 03 Oct 2017 18:26:57 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 703000763
Git revision: 9e2d12d8f63f726de385f37a2ac16cfd96f03cfd
Build date: 2017-11-07 09:25:52-05
Xamarin addins: e55027802133eda79753b3376a69e46ff6126bf3
Build lane: monodevelop-lion-dogfood-vNext

=== Operating System ===

Mac OS X 10.13.0
Darwin 17.0.0 Darwin Kernel Version 17.0.0
    Thu Aug 24 21:48:19 PDT 2017
    root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Internet of Things (IoT) development (Preview) 7.1
Comment 2 Manuel de la Peña [MSFT] 2017-11-08 16:39:53 UTC
Updating the packages does not fix the sample (some of them where outdated).
Comment 3 Manuel de la Peña [MSFT] 2017-11-08 16:41:56 UTC
s/where/were
Comment 4 Manuel de la Peña [MSFT] 2017-11-08 17:09:43 UTC
Also happens with the following env (DIFFERENT MONO runtime): 

=== Visual Studio Community 2017 for Mac (Preview) ===

Version Preview - Internal Dogfood (7.3 build 763)
Installation UUID: 8d12e55e-3489-463f-ac52-8cb4573c5a81
Runtime:
	Mono 5.8.0.14 (2017-10/581dc8b6deb) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 508000014

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

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

=== Xamarin.Profiler ===

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

=== Xamarin.Android ===

Version: 8.0.2.1 (Visual Studio Community)
Android SDK: /Users/mandel/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		6.0   (API level 23)
		7.1   (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.4
SDK Build Tools Version: 25.0.1

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

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

=== Apple Developer Tools ===

Xcode 9.1 (13532)
Build 9B55

=== Xamarin.iOS ===

Version: 11.5.0.202 (Visual Studio Community)
Hash: 0faf7213
Branch: mono-2017-10
Build date: 2017-11-08 16:56:01+0100

=== Xamarin Inspector ===

Version: 1.3.2
Hash: 461f09a
Branch: 1.3-release
Build date: Tue, 03 Oct 2017 18:26:57 GMT
Client compatibility: 1

=== Xamarin.Mac ===

Version: 4.1.0.217 (Visual Studio Community)

=== Build Information ===

Release ID: 703000763
Git revision: 9e2d12d8f63f726de385f37a2ac16cfd96f03cfd
Build date: 2017-11-07 09:25:52-05
Xamarin addins: e55027802133eda79753b3376a69e46ff6126bf3
Build lane: monodevelop-lion-dogfood-vNext

=== Operating System ===

Mac OS X 10.13.0
Darwin 17.0.0 Darwin Kernel Version 17.0.0
    Thu Aug 24 21:48:19 PDT 2017
    root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Internet of Things (IoT) development (Preview) 7.1
Comment 5 Marek Safar 2017-11-09 22:36:01 UTC
This looks very suspicious and it does not look like Mono change. I added the check about 6 years ago

https://github.com/mono/mono/blame/master/mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs#L385

I suspect Cecil has updated to this version of Mono.CompilerServices.SymbolWriter but I think that work was done about 1 year ago which is odd as well.

Considering the check is valid this is not a big issue and I'll try to investigate it further but it should not block the 2017-10 merge
Comment 6 Sebastien Pouliot 2017-11-10 15:08:08 UTC
It's a big* issue since the tooling will refuse existing binaries (e.g. mdb inside nugets or from the component store) so existing customer projects won't build after updating XI/XM.

* A similar issue caused an RCA for 15.3 so this is nor something releasable and, as such, cannot be merged in master.
Comment 7 Sebastien Pouliot 2017-11-10 15:56:32 UTC
@Manuel let's create a smaller test case that use Cecil to load an assembly and related debug file.

That should duplicate the issue with 2017-10's cecil (vs the one used in today's master). From there we can do a binary search to find hone this breakage occurred,
Comment 8 Marek Safar 2017-11-13 14:42:26 UTC
As I wrote earlier and after closer inspection sqlite-net-pcl.1.3.3.nupkg has mismatching dll and mdb in the package.

I don't know why it was not detected earlier (the check is there for 6 years) so perhaps it looks like some XI regression and cecil pull the update a year ago or even earlier.

The most suspicious part to me looks to be the tuner which aggressively loads the debug symbols which I don't know why.
Comment 9 Manuel de la Peña [MSFT] 2017-11-13 23:51:27 UTC
Ok, I have done a binary search in cecil and mono and it does not look like an issue there. xamarin-macios on the other hand has the following commit:

https://gist.github.com/mandel-macaque/71c42add065d2cf2083a8b9c8e1d06b2

As you can see per the commit message:

[macos] Fix pdb mismatch when saving assemblies processed by mmp (#2901)
    
    - https://bugzilla.xamarin.com/show_bug.cgi?id=60277
    - Teach mmp and mtouch resolver to always ask for symbol reading from Cecil
    - In most cases we explicitly load symbols (LoadReferencesStep) but when we don't rewritten assemblies don't match their pdb and we break debugging.

Reverting the commit fixes the issue since it will not complain about the mismatch of the mdb/assembly. Reverting the commit fixes the issue.
Comment 10 Manuel de la Peña [MSFT] 2017-11-14 00:01:12 UTC
*** Bug 60572 has been marked as a duplicate of this bug. ***
Comment 11 Manuel de la Peña [MSFT] 2017-11-14 00:16:58 UTC
*** Bug 60571 has been marked as a duplicate of this bug. ***
Comment 12 Sebastien Pouliot 2017-11-14 00:56:11 UTC
That commit is in master (not only 2017-10) and the bug, being present in master, should not have been identified with 2017-10.

De-tagging/prefixing and re-assigning to Chris
Comment 13 Manuel de la Peña [MSFT] 2017-11-14 15:40:17 UTC
I can confirm that the bug is also present in master with the following env:

=== Visual Studio Community 2017 for Mac ===

Version 7.2.2 (build 7)
Installation UUID: c15ff277-aeb1-48a1-8175-e63fb1f50e54
Runtime:
	Mono 5.4.1.6 (2017-06/1f4613aa1ac) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 504010006

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.0.0
SDK: /usr/local/share/dotnet/sdk/2.0.0/Sdks
SDK Version: 2.0.0
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

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

=== Xamarin.Android ===

Version: 8.0.2.1 (Visual Studio Community)
Android SDK: /Users/mandel/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
		6.0   (API level 23)
		7.1   (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.5
SDK Build Tools Version: 25.0.3

Java SDK: /usr
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

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

=== Xamarin Inspector ===

Version: 1.3.2
Hash: 461f09a
Branch: 1.3-release
Build date: Tue, 03 Oct 2017 18:26:57 GMT
Client compatibility: 1

=== Apple Developer Tools ===

Xcode 9.0 (13247)
Build 9A235

=== Xamarin.iOS ===

Version: 11.7.0.21 (Visual Studio Community)
Hash: 2b1e34ca
Branch: master
Build date: 2017-11-14 14:06:56+0100

=== Xamarin.Mac ===

Version: 4.1.0.309 (Visual Studio Community)

=== Build Information ===

Release ID: 702020007
Git revision: 2236098c68f51eeb447cb947a87371d1e84f6213
Build date: 2017-10-23 11:43:05-04
Xamarin addins: eaa605cf97f25ce184949f32c712b465ca96f665
Build lane: monodevelop-lion-d15-4

=== Operating System ===

Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

Attaching the build logs.
Comment 14 Manuel de la Peña [MSFT] 2017-11-14 15:43:43 UTC
build log failing in master https://gist.github.com/mandel-macaque/bb4bb858a7190cbd5ec183ce09fa9aed
Comment 15 Chris Hamons 2017-11-16 19:30:57 UTC
This patch against Cecil "works"

https://gist.github.com/chamons/19fe3eb330cc62f15f7fd33f90313135

but Jb preferred another approach. 

Currently waiting on him hacking on that / feedback.
Comment 16 Jb Evain 2017-11-16 23:56:38 UTC
Pushed a lightweight fix to unlock you folks in Cecil's upstream.

https://github.com/jbevain/cecil/commit/023812807c0cb0dfe5bb5752df17b8ec0bf5994b

Please make sure this patch makes it downstream :)
Comment 17 Chris Hamons 2017-11-17 18:55:30 UTC
Cherry picked to mono-2017-10, which is what mono master and 2017-10 track 

https://github.com/mono/cecil/pull/19

Once this gets approved, then I can PR bumps to both those mono branches, and then when those go in, I can bump master's mono...
Comment 18 Chris Hamons 2017-11-17 23:07:01 UTC
Mono fixes in. Now https://github.com/xamarin/xamarin-macios/pull/3022 to bump to that mono.
Comment 19 Chris Hamons 2017-11-20 16:42:25 UTC
This should be fixed in latest master (and thus 15.6).
Comment 20 Chris Hamons 2017-12-13 19:58:47 UTC
Added test to cecil - https://github.com/jbevain/cecil/commit/36117614ddd66b62184e7148aa85c25a57193ce7