Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
While inspecting a variable with the debugger when stepping through code, a variable shows as `null` when it is not.
**Steps to Reproduce:**
1. Run the attached sample on iOS simulator.
2. Press the Continue button (no credentials needed)
3. Press the Go Back button (breakpoint is hit)
4. Inspect the "page" variable near the // FIXME: comment
"page" will show as null when it is not.
"page" should have a value while being inspected.
**Build Date & Platform:**
=== Xamarin Studio ===
Version 5.9.4 (build 5)
Installation UUID: e01c3049-a2d2-4e0a-aad8-afe6fb627c4d
Mono 4.0.2 ((detached/c99aa0c)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400020005
=== Apple Developer Tools ===
Xcode 6.3 (7569)
=== Xamarin.iOS ===
Version: 18.104.22.168 (Business Edition)
Build date: 2015-06-30 15:19:13-0400
=== Xamarin.Android ===
Version: 22.214.171.124 (Business Edition)
Android SDK: /Users/johnmiller/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.4 (API level 19)
5.0 (API level 21)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
=== Xamarin Android Player ===
Version: Unknown version
Location: /Applications/Xamarin Android Player.app
=== Xamarin.Mac ===
Version: 126.96.36.199 (Business Edition)
=== Build Information ===
Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8
=== Operating System ===
Mac OS X 10.10.2
Marius investigated this and mentioned the following: "One of the elements in play here (either the runtime or the XS debugger) is giving information on member 'page' from the wrong symbol point, since multiple ones are defined in the same function, so data for which one comes in is undefined (or just the first one always)."
Workaround: Rename the "page" variable to something unique that does not exist somewhere in this method e.g. "otherPage".
From my investigation into this it appears that problem is that objects that are lifting variables are not present in .mdb so scopes of variables can't be determined, hence picking wrong "page" variable.
Moving to mcs bugs.
Implemented compiler part of the fix in master.
mcs now similarly to csc and roslyn emits lifted local variables for state machine (async + iterators) using naming convention which includes scope index.
public static void Main()
async Task Test (int arg)
if (arg > 0)
var x = 1;
var x = 2;
This emits fields as
.field assembly int32 '<x>__1'
.field assembly int32 '<x>__2'
where format is <original-name>__scope-index, scope-index is 1 based to match scope index logic for local variables.
.mdb file then contains section like
<entry index="0" start="0x44" end="0x98" />
<entry index="1" start="0x9e" end="0xf2" />
<entry index="2" start="0x32" end="0x37" />
<entry index="3" start="0x33" end="0x36" />
<entry index="4" start="0x34" end="0x35" />
which can be used to match scope-index to actual IL range.
Portable pdb does the same thing so I tried to implement it in similar way.
Fixed in version 188.8.131.522 (master)
Author: David Karlas??
Commit: f6732039675317f6b3629f2a778b300620753594 (mono/debugger-libs)
Included in Commit: bf92ff6e50a1c1aed237ac5651b44887abd22fbc (mono/monodevelop)
Notice that for this to work, also runtime side needs to be new...
This means, fix will be available as part of Cycle 9 builds.(Mono needs to be 184.108.40.2069 or newer)