When trying to build the tests for monotouch_Microsoft.CSharp_xunit-test.dll on a device we get the following exception from Cecil:
TOUCH : warning MT0078: Incremental builds are enabled with a deployment target < 8.0 (currently 6.0). This is not supported (the resulting application will not launch on iOS 9), so the deployment target will be set to 8.0. [/Users/xamarinqa/agent/_work/3/s/tests/xharness/tmp-test-dir/[xUnit] Mono BCL tests group 4/BCL tests group 4.csproj]
Process exited with code 1, command: (TaskId:66)
/Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/mono-cil-strip.exe '/Users/xamarinqa/agent/_work/3/s/tests/xharness/tmp-test-dir/[xUnit] Mono BCL tests group 4/obj/iPhone/Release64/mtouch-cache/3-Build/monotouch_Microsoft.CSharp_xunit-test.dll' '/Users/xamarinqa/agent/_work/3/s/tests/xharness/tmp-test-dir/[xUnit] Mono BCL tests group 4/bin/BCL tests group 4/iPhone/Release64-unified/BCL tests group 4.app/monotouch_Microsoft.CSharp_xunit-test.dll' (TaskId:66)
Mono CIL Stripper (TaskId:66)
(TaskId:66)
MTOUCH : error : System.IndexOutOfRangeException: Index was outside the bounds of the array. [/Users/xamarinqa/agent/_work/3/s/tests/xharness/tmp-test-dir/[xUnit] Mono BCL tests group 4/BCL tests group 4.csproj]
at Mono.Cecil.Metadata.Utilities.ReadCompressedInteger (System.Byte[] data, System.Int32 pos, System.Int32& start) [0x0002f] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.Cecil.Signatures.SignatureReader.ReadMarshalSig (System.Byte[] data) [0x00000] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.Cecil.Signatures.SignatureReader.GetMarshalSig (System.UInt32 index) [0x00031] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.Cecil.AggressiveReflectionReader.ReadMarshalSpecs () [0x00081] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.Cecil.AggressiveReflectionReader.VisitTypeDefinitionCollection (Mono.Cecil.TypeDefinitionCollection types) [0x00055] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.Cecil.ReflectionReader.VisitModuleDefinition (Mono.Cecil.ModuleDefinition mod) [0x00007] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.Cecil.StructureReader.TerminateAssemblyDefinition (Mono.Cecil.AssemblyDefinition asm) [0x0002e] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.Cecil.AssemblyDefinition.Accept (Mono.Cecil.IReflectionStructureVisitor visitor) [0x0001f] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.Cecil.AssemblyFactory.GetAssembly (Mono.Cecil.Binary.ImageReader irv, System.Boolean manifestOnly) [0x00013] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.Cecil.AssemblyFactory.GetAssembly (Mono.Cecil.Binary.ImageReader reader) [0x00000] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.Cecil.AssemblyFactory.GetAssembly (System.String file) [0x00006] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
at Mono.CilStripper.Program.Main (System.String[] arguments) [0x0005e] in <5ab86655477f49bf9e849e708f3dcbc9>:0 (TaskId:66)
(TaskId:66)
MTOUCH : error MT1009: Could not copy the assembly '/Users/xamarinqa/agent/_work/3/s/tests/xharness/tmp-test-dir/[xUnit] Mono BCL tests group 4/obj/iPhone/Release64/mtouch-cache/3-Build/monotouch_Microsoft.CSharp_xunit-test.dll' to '/Users/xamarinqa/agent/_work/3/s/tests/xharness/tmp-test-dir/[xUnit] Mono BCL tests group 4/bin/BCL tests group 4/iPhone/Release64-unified/BCL tests group 4.app/monotouch_Microsoft.CSharp_xunit-test.dll': Could not strip assembly/Users/xamarinqa/agent/_work/3/s/tests/xharness/tmp-test-dir/[xUnit] Mono BCL tests group 4/obj/iPhone/Release64/mtouch-cache/3-Build/monotouch_Microsoft.CSharp_xunit-test.dll. [/Users/xamarinqa/agent/_work/3/s/tests/xharness/tmp-test-dir/[xUnit] Mono BCL tests group 4/BCL tests group 4.csproj]
The test dll needs to be ignored until this issue is fixed.
This is tracked here: https://github.com/mono/mono/issues/13639
I just verified this still happens on mono 2019-02.
@rolfbjarne thx, I was going to say the same, I forgot I did add one already.