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.
I am observing very strange behavior using Xamarin iOS 7.0.5. The comments in example code help explain the problem.
Take for example the following:
abstract class Foo
private readonly int i;
private readonly int j;
protected Foo(int first, int second)
// this.i resolves properly
this.i = first;
// this.j resolves properly
this.j = second;
// here is the problem
// o will be null because "this" is null
object o = this;
// this will throw a NullReferenceException
// debugger also shows NullReferenceException when evaluating "this" and "o"
// inherited class
public class Bar : Foo
// here is the base constructor
: base(1, 2)
Created attachment 5846 [details]
Shows that "this.NodeType" resolves (in the actual code)
Created attachment 5847 [details]
Shows the debugger show NullReferenceException when evaluating object o = this
Created attachment 5848 [details]
Shows the debugger with NullReferenceException when evaluating "this"
Created attachment 5849 [details]
Shows the actual NullReferenceException because "this" is null
So much for my first bug report. Debugger was throwing an exception because "ToString()" was causing the NullReferenceException. Not your problem. It was mine.