Random NullReferenceException when accessing an adapter.
Posted: Sun Mar 18, 2012 1:28 pm
Hi,
I have an ATag adapter that's stored in the repository. The problem occurs only for this particular adapter (I have a bunch of others). I'm using Internet Explorer 9.0.
Here's how the adapter is created in the code:
The exception I'm getting is "NullReferenceException: Object reference not set to an instance of an object"
If I try to highlight the adapter from the repository, it's being highlighted correctly on the webpage. So I guess there's no problem with the ranorexpath.
I suppose that NullReferenceException means that (troublesomeAdapter == null).
I tried to test whether troublesomeAdapter is null or not in the following way, however the message isn't being logged.
It's really strange that the exception is not being thrown every time I run my testsuite. It's appearing in 50-70% of the cases.
What's the reason and how can it be fixed?
Thanks!
I have an ATag adapter that's stored in the repository. The problem occurs only for this particular adapter (I have a bunch of others). I'm using Internet Explorer 9.0.
Here's how the adapter is created in the code:
Code: Select all
var troublesomeAdapter = repo.myDiv.troublesomeAdapter;
troublesomeAdapter.PressKeys("newvalue", 100); //This line throws an exception
If I try to highlight the adapter from the repository, it's being highlighted correctly on the webpage. So I guess there's no problem with the ranorexpath.
I suppose that NullReferenceException means that (troublesomeAdapter == null).
I tried to test whether troublesomeAdapter is null or not in the following way, however the message isn't being logged.
Code: Select all
if (troublesomeAdapter == null) Report.Failure("troublesomeAdapter is null");
It's really strange that the exception is not being thrown every time I run my testsuite. It's appearing in 50-70% of the cases.
What's the reason and how can it be fixed?
Thanks!