Error "Object Reference not set to an instance of an object"

Jan 25, 2010 at 6:56 PM

Hello everyone,

I am new to web test and coding so please pardon any mistakes!!

I am trying to use the custom validation rule for validating the Inner Text from the Web test plugins. But the problem is, when I use it with a recorded web test, it runs fine..but when I generate the code for it...the test fails and i get the above mentioned error...Please help me..I don't know where am I making a mistake, I have added all the references properly.

Please help since I am stuck and cannot find where the problem is!!!

Feb 1, 2010 at 9:28 PM

Based on the information provided, I am unable to repro this at my end. Could you please point me to or email me the .webtest file so I can try to repro it?

Jul 15, 2014 at 11:04 PM
I had the same problem. Building a test from scratch causes this issue.

I found the same thing you did, if you don't record the test it throws that error. IIRC, once you run the test, the error goes away.
Oct 31 at 11:24 AM
This has been fixed in my vs2015 and vs2017 builds. It was caused by web service requests that had the Content-Type set to application/json but with an empty request body, causing the payload to be null. This then causes the above exception to be thrown in the results view when the webtest is run. Same thing happens on reponses, if the server sets the content-type but the response body is empty.

You can find the new builds, code, wiki and more in my companies GIT Repo