Bug 15727 - Could not find the required assembly 'name-of-my-app.exe' in the app
Summary: Could not find the required assembly 'name-of-my-app.exe' in the app
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.0.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2013-10-26 10:52 UTC by josea
Modified: 2015-08-04 02:31 UTC (History)
3 users (show)

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


Attachments
build log (114.01 KB, text/rtf)
2013-10-26 10:52 UTC, josea
Details
Updated mono-cil-strip.exe (404.50 KB, application/octet-stream)
2013-10-28 10:00 UTC, Sebastien Pouliot
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:
RESOLVED FIXED

Description josea 2013-10-26 10:52:11 UTC
Created attachment 5242 [details]
build log

We are getting the following error in the iPad after compiling and trying to run:

"MonoTouch: Could not find the required assembly 'iCatalogXniOS.exe' in the app. This is usually fixed by cleaning and rebuilding your project; if that doesn't work, please file a bug report: http://bugzilla.xamarin.com"


We have determined that this issue only happens in the ipad when setting the option:

iOS Build/Enable Debugging = false.

If we set the option to true it works fine. Of course we can't do that for the release. It works fine regardless the value of this option in the simulator.

We are using the alpha version of xamarin (4.1.12 build 6) because we use blocks (and that is addressed in the alpha release).

We already contacted support and they requested us to open a bug case.

Please note that after adding the "-v -v -v -v" options to the compiler we see an error that is making the compiler crash. See below. I have attached the complete build log.

/Users/josea2/Documents/iCatalogXn/iCatalogXn.iOS/obj/iPhone/Debug/mtouch-cache/Build/iCatalogXniOS.exe /Users/josea2/Documents/iCatalogXn/iCatalogXn.iOS/bin/iPhone/Debug/iCatalogXniOS.app/iCatalogXniOS.exe
Mono CIL Stripper

Error: System.ArgumentOutOfRangeException: Index is less than 0 or more than or equal to the list count.
Parameter name: index
5
  at System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException (System.String name, System.Object actual, System.String message) [0x00000] in <filename unknown>:0 
  at System.Collections.ArrayList.get_Item (Int32 index) [0x00000] in <filename unknown>:0 
  at System.Collections.CollectionBase.System.Collections.IList.get_Item (Int32 index) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.Cil.VariableDefinitionCollection.get_Item (Int32 index) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.Cil.CodeReader.GetVariable (Mono.Cecil.Cil.MethodBody body, Int32 index) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.Cil.CodeReader.ReadCilBody (Mono.Cecil.Cil.MethodBody body, System.IO.BinaryReader br) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.Cil.CodeReader.VisitMethodBody (Mono.Cecil.Cil.MethodBody body) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.MethodDefinition.LoadBody () [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.FullLoad () [0x00000] in <filename unknown>:0 
  at Mono.CilStripper.AssemblyStripper.FullLoad () [0x00000] in <filename unknown>:0 
  at Mono.CilStripper.AssemblyStripper.Strip () [0x00000] in <filename unknown>:0 
  at Mono.CilStripper.AssemblyStripper.StripAssembly (Mono.Cecil.AssemblyDefinition assembly, System.String file) [0x00000] in <filename unknown>:0 
  at Mono.CilStripper.Program.StripAssembly (Mono.Cecil.AssemblyDefinition assembly, System.String output) [0x00000] in <filename unknown>:0 
  at Mono.CilStripper.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Comment 1 Sebastien Pouliot 2013-10-26 11:55:47 UTC
* Please provide all version information about the software used (the above verison is onyl Xamarin Studio, not Xamarin.iOS).

The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).

* Can you attach the file iCatalogXniOS.exe to the bug report ?

There's something inside it that make the IL stripper unhappy. You can mark the attachment as private (so only you and Xamarin ill see it).

* In the meantime you can try to disable the IL strip from your build. However that means the IL will be part of the application (and could be disassembled). However with a test case we'll likely be able to fix this and give you a better workaround quickly.
Comment 4 josea 2013-10-26 12:11:11 UTC
Where is the option to disable IL strip?
Comment 5 Sebastien Pouliot 2013-10-28 07:46:03 UTC
Add 

    --nostrip

to your "Additional mtouch arguments" in the Project's Options, "iOS Build".
Comment 6 Sebastien Pouliot 2013-10-28 09:56:54 UTC
Fixed in mono master 5b56dc2ce2577375e969f4a9c0a74f7be751ae8b
Comment 7 Sebastien Pouliot 2013-10-28 10:00:45 UTC
Created attachment 5250 [details]
Updated mono-cil-strip.exe

As a workaround (until a fixed mono is released) you'll need to copy the attached file over:

/Library/Frameworks/Mono.framework/Versions/3.2.3/lib/mono/4.5/mono-cil-strip.exe

note #1: please do a backup (of the above file) first
note #2: if you update mono (e.g. 3.2.4) you might need to re-apply the workaround
Comment 8 josea 2013-10-28 11:06:06 UTC
Both solutions work (--nostrip and the new mono-cil-strip). Thanks.
Comment 9 josea 2014-04-10 17:12:16 UTC
This solution seems to not be included in the beta channel yet (almost 6 months later).

Please advise.
Comment 10 Sebastien Pouliot 2014-04-11 08:21:30 UTC
Sadly the Mono 3.2.x releases (and fixes) had a very long life.

pollux:mono sebastienpouliot$ git branch --contains 5b56dc2ce2577375e969f4a9c0a74f7be751ae8b
  master
* mono-3.4.0-branch

The good news is that the fix will be in the upcoming 3.4 release (it's already branched, but I can't say exactly when it will hit alpha/beta/stable channels).

In the measn time the attached tool is identical to what 3.4 will provide.