**Not sure why I cannot post this in Xamarin Test cloud forum, so sorry if this is the wrong area. If it is in the wrong area, please let me know the appropiate place so I can post my question there instead.
I am getting a null reference exception when querying my test app. But running the same code in the repl, it is fine.
See below the repl tree command and the following element I am trying to get text from:
[Toolbar] id: "toolbar" [AppCompatImageButton] [AppCompatTextView] text: "Page title text"
When I run the following query in the Repl, I get that text as expected:
>>> app.Query(c => c.Class("AppCompatTextView")).Select(x => x.Text).FirstOrDefault() Query for Class("AppCompatTextView") gave 1 results. "Page title text"
However, when running this code in my c# UITest:
var pageTitleText = _app.Query(c => c.Class("AppCompatTextView")).Select(x => x.Text).FirstOrDefault();
I get a null reference exception:
Message: System.NullReferenceException : Object reference not set to an instance of an object.
Can anyone please explain what I have done wrong and how to fix. Thanks.