VSTS 2010 : Web Performance Test : Object reference not set to an instance of an object

Locked VSTS 2010 : Web Performance Test : Object reference not set to an instance of an object

  • Thursday, August 16, 2012 6:29 PM
     
     

    I need to do performance testing of on a .Net Web application using VSTS 2010. When I replay the recorded web performance test, I got following error straightforward in login request.

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    I have correlated necessary VIEWSTATE and EVENTVALIDATION parameters and passing successfully in login POST request body.

    I am really stuck in this issue, please help me out in this case.

All Replies

  • Friday, August 17, 2012 2:37 AM
    Moderator
     
     

    Hi Bharatg,

    Thank you for posting in the MSDN forum.

    I would like to know if you are using some kind of data binding and a coded web test. Object reference not set to an instance of an object can be a bug in your coded web test. From http://msdn.microsoft.com/en-us/library/ms318556(VS.80).aspx, this can occur because you have a DataSourceAttribute defined for the Web test class, without a corresponding DataBindingAttribute. To solve this error, add an appropriate DataBindingAttribute.

    Also in order to analyze the detailed information, you can capture the recording log for this page to see what the browser is sending. Then carefully compare it with what is getting sent in the web test by looking at the request headers and body for the request.

    Here is a help link about how to enable VSTS logging:

    http://blogs.msdn.com/b/yutong/archive/2006/10/03/how-to-enable-vsts-logging_3f00_.aspx

    In addition, there is a good article that you can go through in detail and try some of the advanced setting and trouble shooting techniques:

    http://blogs.msdn.com/b/edglas/archive/2007/12/02/web-test-authoring-and-debugging-techniques-for-vs-2008.aspx

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

  • Friday, August 17, 2012 4:06 AM
     
     

    Do find anything in the server side logs. Looks like some parameter is not correctly passed while playing back the web test.

    You can also look at

    http://blogs.msdn.com/b/slumley/archive/2007/04/10/how-to-debug-a-web-test.aspx

    http://blogs.msdn.com/b/edglas/archive/2010/03/24/web-test-authoring-and-debugging-techniques-for-visual-studio-2010.aspx

    Thanks,

    Anuj


    http://www.anujchaudhary.com

  • Friday, August 17, 2012 6:36 AM
     
     

    Thank Amanda and Anuj for Replies.

    I went through the links provided and checked the recording log. The login page has a URL which gets redirected to another server after supplying the credentials. We are able to get the response for the first login page. For the second page we have dependent redirection URL https://.....//InitSession.aspx. In the recording log we are able to get the response for the redirection i.e. the web test recorder detected redirect to "<URL>" But while replaying we are not able to get the redirection response. Could this redirection cause an issue while replaying the webtest?

    please note the application is using HTTPS protocol.

    Anuj, I checked the VIEWSTATE and EVENTVALIDATION parameters and they have been passed correctly.

    Could this issue be related to login functionality implementation?

  • Friday, August 17, 2012 10:15 AM
    Moderator
     
     

    Hi Bharatg,

    For the second page, I would like to know its status, if it appeared to have failed and some other errors occur in the playback window when you replay your test.

    According to your description, it sounds like the top-level request’s dependent request could not be found. This might indicate a problem with the Web application’s HTML. You can try to disable the ParseDependentRequests property on the request. This prevents dependent requests such as images, CSS, and javascript from being automatically parsed out of the HTML and requested.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

  • Tuesday, August 21, 2012 12:37 PM
     
     

    Hi Amanda,

    Thanks for the replies. We have resolved the login redirection issue after deploying some code changes.

    Now we are getting an issue while loading the taskheader in the home page.

    Error Details : 500 Internal server. There is a problem with the resource you are looking for, and it cannot be displayed.

    But on the same machine we are getting desired response in web test recorder and fiddler.

    We tried exporting the fiddler sessions into webtest but it got failed.

    We tried to check whether VSTS is compatible with .net COM component or not and we saw VSTS supports this component.

    Could anyone tell us what could be an issue or steps for troubleshooting?

    Regards,

    Bharat

  • Wednesday, August 22, 2012 2:08 AM
    Moderator
     
     

    Hi Bharat,

    500 Internal Server Error is a very general HTTP status code meaning something went wrong on the web site's server but the server could not be more specific on what the exact problem was. The 500 Internal Server Error message is the most common "server-side" error you'll see.

    Even though the issue is not yours to fix, there are some things you can try:

    1. Reload the web page. You can do that by clicking the refresh/reload button, pressing F5, or trying the URL from the address bar again. Even though the 500 Internal Server Error is reporting a general error on the web site's servers and not your computer, the server error may only be temporary. Trying the page again will often be successful.
    2. Come back later. The 500 Internal Server Error message is one of the most common HTTP error message seen when checking out during an online purchase so sales are often disrupted. This is usually a great incentive to resolve the issue very quickly.

    Since you can get desired response in web test recorder and fiddler, I think that you can ignore the 500   Internal Server Error.

    In addition, here is a help link about  how to use Fiddler to export HTTP sessions into a VSTS web test:

    http://www.fiddler2.com/Fiddler/help/WebTest.asp

    I hope this will be helpful to you.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

  • Friday, August 24, 2012 6:15 AM
     
     

    Hi Amanda,

    Thanks again for the reply.

    The issues which I was facing earlier was solved by code fix and I am able to login into the application but now when I try to navigate to any page, we are getting Unauthorized access issue in every page.

    The page redirects to Unauthorized Access page. We checked the request and verified the session id ,  access token and other parameters, and they seem to be sent correctly in the request.

    The Dev team says somewhere the access token is not getting set properly. But when we check our request parameters, it gets set in cookie properly.

    What could be the issue in this case?

    Regards,

    Bharat

  • Friday, August 24, 2012 8:19 AM
    Moderator
     
     

    Hi Bharatg,

    I would like to know if you get the error when you playback the web test. Could you provide detailed error information on the Unauthorized Access page?

    If possible, you could give a screen shot for resolving this issue.

    Thanks,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

  • Friday, August 24, 2012 8:57 AM
     
     

    Hi Amanda,

    Yes, I am getting the error during playback.

    After login, there is a search page where we are getting this issue.

    Request :

    GET https://..../search.asp?entity=6

    Cookie

    Response:

    Header:

    HTTP/1.1 302 Object moved
    Content-Length : <length>
    Cache-Control : private
    Content-Type : text/html
    Date : Thu, 23 Aug 2012 11:04:10 GMT
    Location : /unauthorized_access.asp?SID=<encrypted value>
    Server : Microsoft-IIS/7.5
    X-Powered-By : ASP.NET

    Body:

    <head><title>Object moved</title></head>
    <body><h1>Object Moved</h1>This object may be found <a HREF="/unauthorized_access.asp?SID=<encrypted value>">here</a>.</body>

    Please find below the screenshot:

    Please let me knkow if you need anything else.

    Thanks,

    Bharat

  • Monday, August 27, 2012 9:32 AM
    Moderator
     
     

    Hello Bharatg129,

    According to your description, it seems that you don’t have permission to view this directory or page using the credentials that you supplied.

    About this issue, the link below about troubleshooting HTTP 401 errors in IIS may help you:

    http://support.microsoft.com/kb/907273

    Also here is a help link about HTTP 401 issue:

    http://support.microsoft.com/kb/871179

    I hope this will be helpful to you.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

  • Monday, August 27, 2012 1:53 PM
     
     

    Hi Amanda,

    I am not getting any 401 HTTP error in the replay where as the page is getting redirected to "Unauthorized Access" aspx page.

    According to the developer team, httpurlreferer is getting set null in the code, So they say if we pass it explicitly in the coded web performance test, the page would be redirected to correct page.

    I have put the following code in the coded web performance test below the concerned request.

    request9.Headers.Add("Referer", "<Refereurl>");

    The application is currently down, So I am not able to check the above piece of code if it would work fine or not.

    Do you have any other suggestions.

    Thanks,

    Bharat
  • Wednesday, August 29, 2012 8:35 AM
    Moderator
     
     Answered

    Hello Bharatg,

    Sorry for my misunderstanding.

    I found you get a 302 error. Getting a 302 error may have something to do with Forms Authentication. If you run a web test on a test server, make sure your web test handle the authentication cookies properly.

    For more detailed information you can refer to this thread:

    http://social.msdn.microsoft.com/Forums/en/vstswebtest/thread/9c6aa4ab-34f0-422d-b571-3b4e44a09e01

    You can try to use Fiddler tool to record your web test to see if the error still will occur.

    And Fiddle might collect more information regarding your Forms Authentication.

    Here is a help link about how to use Fiddle to capture HTTPS sessions and convert to a VSTS web test:

    http://blogs.msdn.com/b/girishp/archive/2010/01/07/how-to-use-fiddler-to-capture-https-sessions-and-convert-to-a-vsts-web-test.aspx

    In addition, you can refer to the login in error after the “HTTP status 302 found” in the web test of the following thread:

    http://social.msdn.microsoft.com/forums/en-US/vstswebtest/thread/4534aabb-6589-4a8c-8134-7a1dc84ca84f

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

  • Friday, August 31, 2012 1:32 AM
    Moderator
     
     

    Hello Bharatg129,

    Any update? Could you get useful information from my reply?

    Would you mind letting us know the result of the suggestion?

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us