locked
Object Reference Not set to an Instance RRS feed

  • Question

  • User-88401470 posted

    I am trying to build a website in Visual studio 2005 and receive the Error 105: Object reference not set to an instance. It doesnot provide any information about the line, file or project. 

    Is there a way to identify the file causing this and fixing it. 

    Thanks!

    Wednesday, April 11, 2012 3:33 PM

Answers

  • User-88401470 posted
    Thank you for your help guys.I found a solution that worked fine for me. Altering my web.config file with the following gets rid of this build error.
    <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       
    <!-- add this line below -->
       
    <remove extension=".rdlc"/>
     
    </buildProviders>
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 12, 2012 5:52 PM

All replies

  • User281315223 posted

    You might want to try debugging and walking through the code until the error occurs (if that is an option). Typically it will be an object not being properly instantiated, such as a collection or object that is null. (You may be missing a "new" keyword)

    You could just set the breakpoint for the beginning of the application - unless this error is occuring within a specific event, in which case you could start there.

    Another option would be to wrap large sections of the application within try-catch blocks in an attempt to narrow the source of the problem.

    Wednesday, April 11, 2012 3:40 PM
  • User-88401470 posted

    I cannot debug it because the build itself is running into the error. And it is not providing any more information about it. 

    It is a huge application which is written by someone else and I am trying to trace through the application

    The solution has multiple projects. The projects build are sucessful but the build of website fails. 

    Wednesday, April 11, 2012 3:46 PM
  • User1564875471 posted

    Try to restart Visual studio and run it as administrator (right click, run as administrator). Also, try to use "Clean" or "rebuild" instead of the normal "build" action.

    Wednesday, April 11, 2012 3:57 PM
  • User-88401470 posted

    Thank you for the replies. Running visual studio as Administrator I tried cleaning the solution and rebuilding it, but the rebuild failed with same error message "Object reference not set to an instance of an object. " It doenot give the file and project information. 

    When I check the output it shows that the 7 out of 8 projects were sucessfully build but the validation of website failed. 

    Wednesday, April 11, 2012 4:09 PM
  • User1564875471 posted

    What will happens if you try to view some of the pages using "View in Browser" option ? do you get an error ? is the project that is cauisng this issue a website ? or a web application ? I mean does it has a project file ? can you try to close VS and clear the asp.net temporary files which can be found under "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" folder ?

    I read somewhere that there is a similar issue in VS 2005, so if you have VS 2008, it's better to use it.You dont have to migrate your project , you can still make them use .NET 2.0.

    Wednesday, April 11, 2012 4:27 PM
  • User-88401470 posted

    When I use the view in browser option, the pages loads without any issues. They have this code deployed. It is a VS2005 solution and the project causing the issue is a website.(Not webapplication). I tried closing the VS, clearing temporary files and rebuilding the solution but still run into the issue. 

    The output in the VS2005 also gives no information. It only shows me the following message "/: Build (web): Object reference not set to an instance of an object."

    Thursday, April 12, 2012 10:28 AM
  • User-88401470 posted
    Thank you for your help guys.I found a solution that worked fine for me. Altering my web.config file with the following gets rid of this build error.
    <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       
    <!-- add this line below -->
       
    <remove extension=".rdlc"/>
     
    </buildProviders>
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 12, 2012 5:52 PM