Bug 40110 - [ppdb] * Assertion at debugger-agent.c:8529, condition `locals->locals [i].index < header->num_locals' not met
Summary: [ppdb] * Assertion at debugger-agent.c:8529, condition `locals->locals [i].in...
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Mac OS
: --- major
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2016-04-05 15:13 UTC by Marek Safar
Modified: 2016-04-07 11:44 UTC (History)
2 users (show)

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

mscorlib.dll (3.48 MB, application/x-msdownload)
2016-04-05 21:35 UTC, Zoltan Varga
mscorlib.pdb (1.34 MB, application/octet-stream)
2016-04-05 21:35 UTC, Zoltan Varga

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 GitHub or 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 Marek Safar 2016-04-05 15:13:47 UTC
Always crashes with simple sample like

using System;
using System.Collections.Generic;
using System.Xml.Serialization;

class X
	public static void Main ()
		XmlReflectionImporter imp = new XmlReflectionImporter ();
		Type type = typeof (List<int>);
		XmlSerializer.GenerateSerializer (
			new Type [] { type },
			new XmlTypeMapping [] { imp.ImportTypeMapping (type) });

1. You need to compile Mono BCL with ppdb support from https://github.com/marek-safar/mono
2. Create console project with code above
3. Start debugging

* Assertion at debugger-agent.c:8529, condition `locals->locals [i].index < header->num_locals' not met


Native stacktrace:

	0   mono                                0x000000010b54287a mono_handle_native_sigsegv + 282
	1   libsystem_platform.dylib            0x00007fff8eee352a _sigtramp + 26
	2   ???                                 0x00007fff6bb76552 0x0 + 140735000569170
	3   libsystem_c.dylib                   0x00007fff813436e7 abort + 129
	4   mono                                0x000000010b701b0a monoeg_log_default_handler + 202
	5   mono                                0x000000010b701a2d monoeg_g_logv + 109
	6   mono                                0x000000010b701e14 monoeg_assertion_message + 356
	7   mono                                0x000000010b578a1d method_commands_internal + 15453
	8   mono                                0x000000010b563a3a debugger_thread + 5882
	9   mono                                0x000000010b6f77a7 inner_start_thread + 311
	10  libsystem_pthread.dylib             0x00007fff914b599d _pthread_body + 131
	11  libsystem_pthread.dylib             0x00007fff914b591a _pthread_body + 0
	12  libsystem_pthread.dylib             0x00007fff914b3351 thread_start + 13
Comment 1 Zoltan Varga 2016-04-05 21:34:23 UTC
This looks like a problem with the .pdb file.
For example, for object:FieldGetter (), this is the corresponding row in the mscorlib.dll file:

6072: instance default void FieldGetter (string typeName, string fieldName, object& val)  (param: 8677 impl_flags: cil managed )

and the corresponding rows in the localscope table in the .pdb file:

6767: method=6072 import=822 locals=4189
6768: method=6073 import=822 locals=4192

So according to the previous table, this method has 3 locals, but actually, it has 3, because it has
no body.
Comment 2 Zoltan Varga 2016-04-05 21:35:06 UTC
Created attachment 15615 [details]
Comment 3 Zoltan Varga 2016-04-05 21:35:31 UTC
Created attachment 15616 [details]
Comment 4 Zoltan Varga 2016-04-05 21:36:43 UTC
I mean:
So according to the previous table, this method has 3 locals, but actually, it has 0, because it has
no body.
Comment 5 Marek Safar 2016-04-06 19:21:41 UTC
This is the output by using Microsoft pdb2ml (it looks like it does not support custom mscorlib) but it should give you hint what's wrong.

It looks like we are mixing parameters with locals.

The full output for the method

    <method containingType="System.Object" name="FieldGetter" parameterNames="typeName, fieldName, val">
        <entry offset="0x0" startLine="327" startColumn="13" endLine="327" endColumn="71" document="251" />
        <entry offset="0x2" startLine="329" startColumn="13" endLine="329" endColumn="34" document="251" />
        <entry offset="0x5" startLine="330" startColumn="17" endLine="330" endColumn="61" document="251" />
        <entry offset="0x10" startLine="332" startColumn="13" endLine="332" endColumn="40" document="251" />
        <entry offset="0x18" startLine="334" startColumn="17" endLine="334" endColumn="60" document="251" />
        <entry offset="0x22" startLine="341" startColumn="13" endLine="341" endColumn="63" document="251" />
        <entry offset="0x24" startLine="342" startColumn="13" endLine="342" endColumn="62" document="251" />
        <entry offset="0x26" startLine="343" startColumn="13" endLine="343" endColumn="42" document="251" />
        <entry offset="0x2e" startLine="345" startColumn="17" endLine="345" endColumn="47" document="251" />
        <entry offset="0x31" startLine="346" startColumn="21" endLine="346" endColumn="74" document="251" />
        <entry offset="0x37" startLine="347" startColumn="17" endLine="347" endColumn="41" document="251" />
        <entry offset="0x3b" startLine="348" startColumn="21" endLine="349" endColumn="93" document="251" />
        <entry offset="0x44" startLine="353" startColumn="13" endLine="353" endColumn="110" document="251" />
      <scope startOffset="0x0" endOffset="0x54">
        <local name="stackMark" il_index="0" il_start="0x0" il_end="0x54" attributes="0" />
        <local name="capturedSyncContext" il_index="1" il_start="0x0" il_end="0x54" attributes="0" />
        <local name="capturedExecutionContext" il_index="2" il_start="0x0" il_end="0x54" attributes="0" />
Comment 6 Marek Safar 2016-04-06 19:28:04 UTC
Hmm, the sequence points make no sense they are from different file.

This really looks like roslyn bug (or the dump tool but that's not likely)
Comment 7 Zoltan Varga 2016-04-06 19:33:30 UTC
Yes, the FieldGetter method doesn't have these locals, they are from another method.
Comment 8 Marek Safar 2016-04-07 11:44:38 UTC
Reported as roslyn bug.