There is an issue when `mtouch` tries to report a MT2102 error . The additional information being reported sadly cause a `NullReferenceException` which results in less (not more) information about the original issue.
Since this exception happens in the MT2xxx (linker) exception handler it gets reported as an MT0000 by the top-level handler. This will look like this:
> MTOUCH: error MT0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
> System.NullReferenceException: Object reference not set to an instance of an object
> at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x00145]
*** Bug 58768 has been marked as a duplicate of this bug. ***
*** Bug 58784 has been marked as a duplicate of this bug. ***
*** Bug 58777 has been marked as a duplicate of this bug. ***
Created attachment 24207 [details]
mtouch fix for MT0000
The attached .zip file contains an updated version of mtouch.exe and mtouch.pdb (the corresponding debugging symbols).
The content of the zip should only be used to replace `mtouch` on a Mac for version 10.12.0.0 to 10.12.0.18.
To use this please start by doing a backup of the files, e.g.
> cp /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mtouch/mtouch.* ~/
Then extract the archive over the original ones, e.g.
> unzip ~/Download/mtouch58789.zip -d /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mtouch/
If asked confirm (y) to overwrite over the files.
Finally clean your solution and build again. Your build should now report an MT2102 error including details like the method name, the assembly name and the reason they could not be processed.
*** Bug 58791 has been marked as a duplicate of this bug. ***
I don't have "Current" folder but I do have "10.12.0.18" folder which I assume has correct files.
Sebastien, do you have VS2017 Preview installed?
@Yuri in your case `Current` should be a symlink to the `10.12.0.18` folder, it's a way to simplify scripting over different versions of our SDK. Copying inside the `.../10.12.0.18/lib/mtouch/` will be identical.
WRT "VS2017 Preview" I run exclusively on macOS, we have a separate team to handle the VS/Windows extension. However the attached fix should work from Windows too (since mtouch is executed on the macOS side).
I wrote files from zip file and started to get strange errors about Grid constructor. So, I rolled back original files, removing 2017 Preview and repair VS2017 stable version. Then I will go from there
@Yuri, the exception causing the `MT0000` was inside a block reporting another error. So it's perfectly normal and expected that you'll get a `MT2102` error after applying the fix. If you want you can reply with more details (e.g. new build logs) in your original bug report.
In any case there is no need to repair VS2017 (from Windows). You can replace your original files (if you wish, the only change is how the MT2102 error is reported). Only clean your solution and rebuild it is needed between the changes (of files).
*** Bug 58796 has been marked as a duplicate of this bug. ***
*** Bug 58762 has been marked as a duplicate of this bug. ***
With files from zip I am getting the follow:
Severity Code Description Project File Line Suppression State
Error Error processing the method 'System.Void Xamarin.Forms.DataGrid.DataGridColumn/<>c::.cctor()' in the assembly 'Xamarin.Forms.DataGrid.dll': Value cannot be null. ButtonRendererDemo.iOS
Error Metadata Error while reading 'C:\Temp\Xamarin\ButtonRendererDemo\ButtonRendererDemo\ButtonRendererDemo.iOS\obj\iPhone\Debug\ButtonRendererDemoiOS.exe': Could not find a part of the path 'C:\Temp\Xamarin\ButtonRendererDemo\ButtonRendererDemo\ButtonRendererDemo.iOS\obj\iPhone\Debug\ButtonRendererDemoiOS.exe'. ButtonRendererDemo.iOS 1 Active
What are next steps to fix that?
I also received a similar error after replacing mtouch.exe as mentioned above.
4>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(748,3): error : Error processing the method 'System.Void ProjectName.Forms.Constants::.cctor()' in the assembly 'ProjectName.Forms.dll': Value cannot be null.
4> Parameter name: instruction
My ProjectName.Forms.Constants class is a simply like:
public static class Constants
public static readonly string UserAction = "UserAction";
public static readonly string ICMessage = "IC";
public static readonly string ULIMessage = "ULI";
public static readonly string ULOMessage = "ULO";
public static readonly string UHPI = "UHPI";
public static readonly string CIR = "CIR";
public static readonly string CIROFI = "CIROFI";
public static readonly string CIRR = "CIRR";
public static readonly string USTC = "USTC";
public static readonly string UGDI = "UGDI";
public static readonly string ITC = "ITC";
public static readonly string ONS = "ONS";
public static readonly int DPS = 30;
public static readonly TimeSpan DCT = TimeSpan.FromMinutes(60);
For me, replacing the mtouch files game the following error:
/Users/nischal/Desktop/c2mservice/iOS/MTOUCH: Error MT2102: Error processing the method 'System.Void Couchbase.Lite.Storage.SQLCipher.SqliteCouchStore/<GetDocNumericID>c__AnonStorey6::.ctor()' in the assembly 'Couchbase.Lite.Storage.SQLCipher.dll': Value cannot be null. (MT2102) (Connect2Metrics.iOS)
I've since tried removing and re-adding the said package, but no luck
I am getting similar issues - replacing the mtouch files I now get the following error when building from a VS2015 windows agent on a mac that is running xamarin studio.
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(748,3): error : Error processing the method 'System.Void Name.Class::.cctor()' in the assembly 'Name.dll': Value cannot be null.
There is a high probability that the MT2102 issues you're facing are identical (or variations) but they could be different in some cases.
What we need now are full build logs (see below) to see a complex stack trace and the binaries to analyze, e.g. for an error showing:
> ,,, in the assembly 'Name.dll' ...
We need to have `Name.dll`, `Name.pdb` and `Name.dll.mdb` (it's likely that only one of the debugging symbols will be present, not both) attached to the bug report.
This is a different issue than the MT0000 and you might want those information to be private. Please open a new bug report (or reuse your original one) to provide the information confidentially. Thank you all!
Please include your full build logs, all your version information and the most important thing a test case (to reproduce).
To get full build logs just set the log verbosity to diagnostic at the following locations:
- On Visual Studio for Mac: Preferences > Projects > Build
- On Visual Studio for Windows: Tools > Options > Projects and Solutions > Build and Run
On Visual Studio Windows you also want to add `-v -v -v -v` to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting `Properties`.
Note: this is done automatically on Visual Studio for Mac when the log verbosity is set to diagnostic.
The build that is failing for us is our current release branch, which uses xamarin.forms 184.108.40.206.
Our dev branch, which is on a slightly newer xamarin.forms 220.127.116.11, did manage to build successfully on iOS#AppStore configuration, through what is essentially the same build definition/agent/mac combo.
Now having another go at the release branch with an updated xamarin.forms package, but it hasn't been successful yet (for other reasons).
Created attachment 24243 [details]
ios build output
This is diagnostic and "-v ..." output window. I am not sure where to get log file if you still need it.
Just adding that the build that was failing beforehand did indeed work after updating xamarin.forms from 18.104.22.168 to 22.214.171.124.
I am using 126.96.36.199 but no luck
I am still stack. Any suggestions?
*** Bug 58825 has been marked as a duplicate of this bug. ***
@Luis there was an issue  with XF's `xamlc` not updating the debug symbols (pdb) file that was fixed in the newer version of XF that you're using .
Now this might not be an XF issue in every case but incorrect (or out of sync) debug symbols can lead to build failures.
One way to check this in your builds would be to delete the debug symbols (copy them first) for the assembly mentioned sin the MT2102 error message.
E.g. if the error is reported on `Name.dll` then delete all copies of `Name.pdb` and `Name.dll.mdb` inside your project (only one should exists).
Note: that should not be an issue if you build the mentioned assembly from sources (unless the old `xcmlc` is used) but, if you're using binaries (e.g. nuget) then it's worth trying (since it will be hard to know of it was produced).
*** Bug 58820 has been marked as a duplicate of this bug. ***
@Sebastain I cannot remove Xamarin DLL which I am getting error from. I see chaaaau is getting similar issue also about some constructor. What are we suppose to do?
@Yuri please read carefully. You have never been told to remove any .dll, you need those files.
The file(s) that should be removed are not the code (.dll) but the debugging symbols, i.e. with a `.pdb` or `.dll.mdb` extension. Just in case make sure to create a copy of the files before deleting them.
If the build works without the debug symbols (for the mentioned assembly in the MT2102 error) then it's a good indication that they are either corrupted (or out of sync). In that case you'll need to update your package for those files.
@Sebastain thank you. Can you please tell me the location of those `.pdb` or `.dll.mdb` files. Are they on Windows (I am using VS 2017) or MAC?
@Yuri from the logs you attached your error is:
2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(748,3): error : Error processing the method 'System.Void Xamarin.Forms.DataGrid.DataGridColumn/<>c::.cctor()' in the assembly 'Xamarin.Forms.DataGrid.dll': Value cannot be null.
So you're looking for a `Xamarin.Forms.DataGrid.pdb` file which (from your logs) seems to located in
note: there's no sign of a `Xamarin.Forms.DataGrid.dll.mdb` file (which is normal, both formats should not exists at the same time).
Next copy that file (e.g. to your desktop) and then delete it (from the above location).
Make sure to clean your solution before building it - because copies of the .pdb file might exists in your cached/temporary build files. You can double check your build log to ensure the string `Xamarin.Forms.DataGrid.pdb` is nowhere to be seen.
This is the error that I get:
Error processing the method 'System.Void SQLiteNetExtensions.Extensions.ReadOperations::GetChildrenRecursive(SQLite.Net.SQLiteConnection,System.Object,System.Boolean,System.Boolean,System.Collections.Generic.Dictionary`2<System.String,System.Collections.Generic.Dictionary`2<System.Object,System.Object>>)' in the assembly 'SQLiteNetExtensions.dll': Value cannot be null.
which is caused by the following:
using ObjectCache = Dictionary<string, Dictionary<object, object>>;
This is valid C# so it seems like the linker doesn't work with using statements declared at the class level
I applied the patch from comment 4 of https://bugzilla.xamarin.com/show_bug.cgi?id=58789, downgraded the Xamarin.Auth version used in my iOS build to 188.8.131.52 (thankfully, I had already arranged my Xamarin.Auth related code such that I can use different versions for different platforms), and turned off linking. That combination got things working again for me.
@Sebastien So here what happens.
I have 2 files in project when I download the Grid package dated 06/06/2017
When I build the project another file shows up dated today
and build fails
After I delete pdb file only and kept mdb the build still fails
After I delete both pdb and mdb files rebuild succeeds and no mdb files shows in the folder.
What is the next step to return debug symbols back?
I just realised that DataGrid is third-party software. I can remove it completely but that will require to rewrite some of my code or it can be fixed.Please advice.
Based on some follow-up investigation of the linker errors (the ones that appear after applying the patch from Comment 4), it appears that the underlying problem is in some sense a "version mismatch" where a fix for a bug in Mono.Cecil  has not yet been integrated as expected into Xamarin.iOS.
I suspect it might not be possible to work around the issue with the existing binaries of Xamarin.iOS 10.12, so I believe the next step will be for the Xamarin.iOS team to integrate the Mono.Cecil change and test a candidate build that includes the fix. I will check with the team about the quickest way to share the (in-progress) candidate fix with users too.
@Yuri, I also had trouble with "MTOUCH: Error MT2102 ... ::.ctor()' in the assembly 'name.dll': Value cannot be null. I fixed this by deleting all the bin/obj folders and also the project.lock.json file. Maybe this helps for you.
PR for d15-3 https://github.com/xamarin/xamarin-macios/pull/2510
*** Bug 58874 has been marked as a duplicate of this bug. ***
An experimental installer package with the candidate fix for the MT0000 issue as well as the follow-up MT2102 errors is now available.
For any user who might like to try that experimental version, see Bug 58834, Comment 10 for the download link and information about installing and uninstalling it.
Merged in https://github.com/xamarin/xamarin-macios/commit/80b8487d5d9bfcb845ee9636082c9a7d1fb59076
To be released in upcoming SR2
*** Bug 58931 has been marked as a duplicate of this bug. ***
## Status update for any users watching this issue
The candidate fix for this issue has now been published to the Stable and Beta updater channels as part of Xamarin.iOS 10.20.0.20 in the Xamarin 15.3.2 Servicing Release .
## Status update for any users watching this issue
The candidate fix for this issue has now been published to the Stable and Beta updater channels as part of Xamarin.iOS 10.12.0.20 in the Xamarin 15.3.2 Servicing Release .
*** Bug 58978 has been marked as a duplicate of this bug. ***
This bug is verified fixed, and the fix is released. No further action by QA is required.