11 January 2014

visual studio error/exception and resolution

Sometimes while working with Visual Studio IDE (Integrated Development Environment) we encounter exceptions. When such exceptions occurs, Visual Studio pop up a Exception dialog displaying little useful information. So Visual Studio IDE users, will end up googling and wasting time. Below is the list of Visual Studio exceptions occurred and how can we resolve such exceptions.

  1. Golden rule to get rid of Visual Studio errors:

    When exception encountered and the error dialog is not giving enough clue to resolve the issue, close the Visual Studio application and reopen the solution; Most of the time, restarting Visual Studio will do the trick and solves the unexpected error.

  2. Error / Exception statement-1:

    Recently faced error message, "The parameter is incorrect" while trying to run a new unit test added to a unit test project using the Test View of Visual Studio.

    ---------------------------
    Microsoft Visual Studio
    ---------------------------
    Exception was thrown: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

    Solution to fix the exception dialog:

    Were able to run the unit tests after closing Visual Studio and reopening the Test Project.

  3. Error / Exception statement-2:

    Encountered the exception, "data.coverage is invalid or corrupt" while trying to see the Code Coverage for a solution built using Visual Studio.

    ---------------------------
    Microsoft Visual Studio
    ---------------------------
    Code Coverage Analysis engine threw exception(s):
    Coverage file "Solution physical path\TestResults\data.coverage" is invalid or corrupt.

    Solution to fix the exception dialog:

    This issue was happening because of disk space issue. After deleting all the content in "Test Results" folder and freeing up the space, were able to view the code coverage.