Bug 58188 - Debugger crashes with ArgumentException when arriving at breakpoint or setting breakpoint in iOS
Summary: Debugger crashes with ArgumentException when arriving at breakpoint or settin...
Status: RESOLVED DUPLICATE of bug 57916
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Debugger ()
Version: 4.5.0 (15.2)
Hardware: PC Windows
: Normal normal
Target Milestone: 15.4
Assignee: Joaquin Jares
Depends on:
Reported: 2017-07-17 14:02 UTC by Andre Oelmann
Modified: 2017-07-18 17:03 UTC (History)
3 users (show)

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

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 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:

Description Andre Oelmann 2017-07-17 14:02:14 UTC
When trying to set a breakpoint in an ui related class in a running Xamarin.iOS project, the debugger stops with presenting an error dialog.
That happens, if I want to set a breakpoint in derived classes of UIViewController or UINavigationController.
If I set the breakpoint before start debugging, the error dialog appears when the breakpoint is hit.

I am using VS2017, Xamarin iOS 10.10.37 on Windows site and 10.10.36 on Mac site.

I get the following Exception (in german, meaning: Array offset and length are out of bounds):

Offset und Länge für das Array liegen außerhalb des gültigen Bereichs, oder die Anzahl ist größer als die Anzahl der Elemente vom Index bis zum Ende der Quellauflistung.
System.ArgumentException: Offset und Länge für das Array liegen außerhalb des gültigen Bereichs, oder die Anzahl ist größer als die Anzahl der Elemente vom Index bis zum Ende der Quellauflistung.
   bei System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count)
   bei Mono.Cecil.Metadata.GuidHeap.Read(UInt32 index)
   bei Mono.Cecil.MetadataReader.InitializeCustomDebugInformations()
   bei Mono.Cecil.MetadataReader.GetCustomDebugInformation(ICustomDebugInformationProvider provider)
   bei Mono.Cecil.Cil.PortablePdbReader.Read(MethodDefinition method)
   bei Mono.Cecil.Cil.CodeReader.ReadMethodBody()
   bei Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   bei Mono.Cecil.MethodDefinition.<>c.<get_Body>b__41_0(MethodDefinition method, MetadataReader reader)
   bei Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   bei Mono.Cecil.MethodDefinition.get_Body()
   bei Mono.Cecil.MethodDefinition.get_DebugInformation()
   bei Mono.Debugging.Soft.SoftDebuggerSession.LoadPdbType(TypeDefinition type, Dictionary`2 fileToSourceFileInfos)
   bei Mono.Debugging.Soft.SoftDebuggerSession.LoadPdbFile(String assemblyFileName, String pdbFileName)
   bei Mono.Debugging.Soft.SoftDebuggerSession.LoadDebugFile(String assemblyFileName, String debugFileName, Func`3 loadDebugFile)
   bei Mono.Debugging.Soft.SoftDebuggerSession.CheckBetterMatch(TypeMirror type, String file, Int32 line, Int32 column, Location found)
   bei Mono.Debugging.Soft.SoftDebuggerSession.FindLocationByMethod(MethodMirror method, String file, Int32 line, Int32 column, Boolean& insideTypeRange)
   bei Mono.Debugging.Soft.SoftDebuggerSession.FindLocationByType(TypeMirror type, String file, Int32 line, Int32 column, Boolean& genericMethod, Boolean& insideTypeRange)
   bei Mono.Debugging.Soft.SoftDebuggerSession.ResolveBreakpoints(TypeMirror type)
   bei Mono.Debugging.Soft.SoftDebuggerSession.HandleTypeLoadEvents(TypeLoadEvent[] events)
   bei Mono.Debugging.Soft.SoftDebuggerSession.HandleEventSet(EventSet es)
   bei Mono.Debugging.Soft.SoftDebuggerSession.EventHandler()
Comment 1 Joaquin Jares 2017-07-17 16:48:30 UTC
Hi @Andre, I would need to know what your environment looks like (that is, go to Help -> About in VS, click Copy Info and paste it here). Also, are you using portable pdbs? (That is, is your iOS project set to Portable in Properties -> Build -> Advanced -> Debugging Information). 

Comment 2 Andre Oelmann 2017-07-18 06:45:53 UTC
Hi Joaquin,

it was a misconfiguration.
Yes, I am using portable pdbs for the PCLs in my solution. Accidentally I also set my iOS project to portable and that was the mistake. After I set it back to full (only for the iOS project), everything is working again.

Thanks for your advise

Comment 3 Joaquin Jares 2017-07-18 17:03:10 UTC
@Andre, Portable should work in iOS too, though. I'll mark it as duplicate of 57916 for now and we can change it if a fix for that doesn't resolve this.
Comment 4 Joaquin Jares 2017-07-18 17:03:37 UTC

*** This bug has been marked as a duplicate of bug 57916 ***