9

I created Xamarin Forms app. I use multidex for Android (many libraries). I use multidex.keep file with MultiDexMainDexList option. Now deployment is work. But I get exception in debug mode :

 System.ArgumentException: The offset and length have exceeded the bounds of the array or the counter value exceeds the number of elements from the pointer to the end of the original collection.
 в System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count)
 в Mono.Cecil.Metadata.GuidHeap.Read(UInt32 index)
 в Mono.Cecil.MetadataReader.InitializeCustomDebugInformations()
 в Mono.Cecil.MetadataReader.GetCustomDebugInformation(ICustomDebugInformationProvider provider)
в Mono.Cecil.Cil.PortablePdbReader.Read(MethodDefinition method)
в Mono.Cecil.Cil.CodeReader.ReadMethodBody()
в Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
в Mono.Cecil.MethodDefinition.<>c.<get_Body>b__41_0(MethodDefinition method, MetadataReader reader)
в Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
в Mono.Cecil.MethodDefinition.get_Body()
 Mono.Cecil.MethodDefinition.get_DebugInformation()
в Mono.Debugging.Soft.SoftDebuggerSession.LoadPdbType(TypeDefinition type, Dictionary`2 fileToSourceFileInfos)
в Mono.Debugging.Soft.SoftDebuggerSession.LoadPdbFile(String assemblyFileName, String pdbFileName)
в Mono.Debugging.Soft.SoftDebuggerSession.LoadDebugFile(String assemblyFileName, String debugFileName, Func`3 loadDebugFile)
в Mono.Debugging.Soft.SoftDebuggerSession.CheckBetterMatch(TypeMirror type, String file, Int32 line, Int32 column, Location found)
в Mono.Debugging.Soft.SoftDebuggerSession.FindLocationByMethod(MethodMirror method, String file, Int32 line, Int32 column, Boolean& insideTypeRange)
в Mono.Debugging.Soft.SoftDebuggerSession.FindLocationByType(TypeMirror type, String file, Int32 line, Int32 column, Boolean& genericMethod, Boolean& insideTypeRange)
в Mono.Debugging.Soft.SoftDebuggerSession.ResolveBreakpoints(TypeMirror type)
в Mono.Debugging.Soft.SoftDebuggerSession.HandleTypeLoadEvents(TypeLoadEvent[] events)
в Mono.Debugging.Soft.SoftDebuggerSession.HandleEventSet(EventSet es)
в Mono.Debugging.Soft.SoftDebuggerSession.EventHandler()

For analysis I use - dex2jar and Java Decompiler(by this article). But now I do not know what to look for and what is the problems.

Any ideas?

FetFrumos
  • 5,388
  • 8
  • 60
  • 98
  • So this is happening in a `Debug` configuration. The exception above looks more like an issue connecting to the soft debugger. Since there's no trace of any Multidex Task in the above trace, I'm hesitant to say it's related to Multidex until we have a minimal reproduction. Can you add one to your post? – Jon Douglas Jun 13 '17 at 14:49
  • Hi, Jon. My debugger is working now! It was a problem with my project. I have XF 2.3.4.247 in my project. I installed XF 2.3.5.239 (pre), and then deleted it and installed the stable version 2.3.4.247. And after that debugging worked. Thank you for your blog - this is very useful information. I'm waiting your book about Xamarin Android. – FetFrumos Jun 13 '17 at 16:08

1 Answers1

0

I solved this problem.

This is describe in detail my user case:

  1. I used PCL library.
  2. I need update Azure Mobile Client to version 4.0. This version not supported PCL only .NET Standard. 1.4.
  3. But I have Windows Phone project with Xamarin Forms. WP not supported .Net Standard 1.4
  4. I add new library in my solution( .NET Standard. 1.4). I added files to this library from my PCL as link.
  5. Then there was this error. At first it was a floating bug - but then it was permanent.
  6. I spent two full working days looking for the cause of this error. I found a place where the application was dropping.
  7. I deleted the associated file from my library(.Net Standard), and then added it. Now debugging works.
FetFrumos
  • 5,388
  • 8
  • 60
  • 98