none
Object reference not set to an instance of an object while publishing web site

    Question

  • hi,

    While buliding my application, it shows no error, While Publishing with Strong name key, im getting "Object reference is not set to an instance of a Object" without any line no in error list.

    what is wrong in it?

    Please guide me...

    Monday, August 16, 2010 9:31 AM

Answers

  • At run time when you are creating the concern object it is is returning null hence the error. e.g. creating a xmldocument object while file doesn't exist at specified path

    debug your code and find out cause of exception in the code.


    Manish Sati
    • Proposed as answer by Roahn Luo Tuesday, August 17, 2010 2:13 AM
    • Marked as answer by Roahn Luo Tuesday, August 24, 2010 1:24 AM
    Monday, August 16, 2010 12:01 PM

All replies

  • At run time when you are creating the concern object it is is returning null hence the error. e.g. creating a xmldocument object while file doesn't exist at specified path

    debug your code and find out cause of exception in the code.


    Manish Sati
    • Proposed as answer by Roahn Luo Tuesday, August 17, 2010 2:13 AM
    • Marked as answer by Roahn Luo Tuesday, August 24, 2010 1:24 AM
    Monday, August 16, 2010 12:01 PM
  • Hello Akilaskk,

    Have you tried Manish Sati's suggestion?

    To add more on how to enable debugging for your web application, you could go to web.config file and make sure you set true in <compilation> section:

    <compilation debug="true">

    Lookinf forward to your reply.

    Thanks a lot!


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Tuesday, August 17, 2010 2:13 AM
  • Akilaskk's problem: building my application, it shows no error, While Publishing ... "Object reference is not set to an instance of a Object" without any line no in error list. 

    This is not a run time problem where he is creating objects.  It is a compile / publish probem.  So the suggestion to enable debugging so he can debug his application does not make any sense.

    I have the same problem with Visual Studio 2010: clean buld, then Object reference is not set to an instance of a Object when publishing. The error has some something to do with the App_Code contents:

    Building directory '/ROCPWeb/App_Code/'.: Publication (web): Object reference not set to an instance of an object.

     

     

    My publish options were "Allow this precomplied site to be updatable" , "Use fixed naming and single page assemblies" and No strong key.

    When I removed those publish options, I got several "Circular file references are not allowed." errors.  These errors pointed to the master page reference <%@ MasterType VirtualPath="~/ROCP.master" %> on the content page.  Clearly not a circular file reference.

    Changed publish options just "Use fixed naming and single page assemblies".  Publish hangs building App_code folder (8 core, 8 gb, 2.50ghz).

    Changed publish options just "Use fixed naming and single page assemblies".  "Circular file references are not allowed." errors reappeared.

    I'm stuck.  Strangely I successfully published this web site 2 weeks ago when i uopdated it.

     

     

     

    Setting the MSBuild project build output verbosity to diagnostic did not change the build output so I could not get any more information.
    • Proposed as answer by SacNetGuy Monday, December 27, 2010 9:25 PM
    • Edited by SacNetGuy Monday, December 27, 2010 9:26 PM
    Monday, December 27, 2010 7:47 PM
  • Update:

    after repeatedly attempting to publish, deleting all the files in C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files (no effect), rebooting and then dusting my project with angel powder, the web site was PUBLISHED.  No clue why it successfully published. Probably tried about 20 times.

    I propose angel powder as the solution.

     


    Sac Net Guy
    • Proposed as answer by SacNetGuy Monday, December 27, 2010 9:25 PM
    Monday, December 27, 2010 9:25 PM
  • Just received a request to make a change to the site so I have to publish it again but I am out of angel dust!!!! Pray for me.
    Sac Net Guy
    Monday, December 27, 2010 10:01 PM
  • I've been having this problem all morning and finally resolved it.

    Looks like the angel dust you need involves deleting your bin directory and starting over.  I had to re add some references but once that was complete the publish worked.  What a pain!

    Monday, January 31, 2011 4:25 PM
  • I hesitated posting my final "solution" because it does not make sense to me.  One of my previous attempts to solve this problem was deleting the Bin folder but that did not fix the problem.  I was encountering this Object not set to a reference intermittently.  Then another project would build but not would publish.

     

    I noticed that the folder containing all my project was compressed (for some reason).    Once I had Windows remove the compression, all my problems (at least in this area) disappeared.  If I had any guts I would compress the folder again and see if the myriad of problems re-appear.  But I wasted hours and hours already so I am not going to tempt fate.


    Sac Net Guy
    • Proposed as answer by SacNetGuy Monday, January 31, 2011 10:43 PM
    Monday, January 31, 2011 10:43 PM
  • I ran into this same issue today. In an attempt to save space (SSD is smaller than conventional drives), I compressed my source folders. As soon as I did so, I started getting circular reference errors and the build wouldn't complete. It appears that Visual Stupid gets stupid when you turn on folder compression.
    Tuesday, February 28, 2012 7:39 PM
  • In my case that fuc... error was in my websites build for .net 4.0 that has this fuc... line:

    [assembly: System.Security.AllowPartiallyTrustedCallers]

    Remove it from your webforms and check the impact if you show reports because with .net 4.0 is there another way to configure this and works fine!!! :)
    • Proposed as answer by esanchezfo Monday, September 17, 2012 7:54 PM
    Sunday, July 15, 2012 4:54 PM
  • I am also getting same type of error but i am unable to find the soultion for it , i am stuck up here
    Monday, August 06, 2012 5:35 AM
  • I am also getting same error not able to get soultion for it .
    Monday, August 06, 2012 5:37 AM
  • In the worst scenario when you publish and get this error you can get the compiled (working assemblies) from C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\APPLICATIONNAME\2715857f\51b3e61d (the last two folders may vary).

    And the aspx take from original with basic changes (take a published one to adjust header only the contents are the same).

    Monday, September 17, 2012 7:56 PM
  • I can't say what occured with my website for this same problem to occur but attempted all above resolutions with no success. Found the problem seemed to be intermittent to the point where if a single page needed to be compiled it would happen.

    Same issue would build ok but not publish removing allow precompiled site to be updated solved the problem.

    Not really desirable but the only thing that would solve the issue.

    • Proposed as answer by Craig Downey Monday, October 01, 2012 9:49 AM
    • Unproposed as answer by Craig Downey Monday, October 01, 2012 9:49 AM
    • Proposed as answer by Craig Downey Monday, October 01, 2012 9:50 AM
    • Unproposed as answer by Craig Downey Monday, October 01, 2012 9:50 AM
    Monday, October 01, 2012 8:04 AM
  • Found the problem, damn Mcafee real time scanning turned it off and worked ok, turn it on and would not publish.
    • Proposed as answer by Craig Downey Monday, October 01, 2012 9:52 AM
    Monday, October 01, 2012 9:52 AM
  • Found the problem, damn Mcafee real time scanning turned it off and worked ok, turn it on and would not publish.

    This was exactly the cause for my problem! Thanks, Craig! McAfee wasted almost two days of my time. Uninstalling it right away.

    Regards

    Z

    • Proposed as answer by Ogonna Tuesday, November 06, 2012 2:47 PM
    Wednesday, October 03, 2012 7:16 AM
  • Yes, for me its exactly because of Mcafee.

    I just got my software updates (include Mcafee) and then suddenly the publishing problem comes up.

    After closing real time scan and leave others, the publishing is now OK.

    Thanks Craig!

    • Proposed as answer by Ogonna Tuesday, November 06, 2012 2:47 PM
    Thursday, October 04, 2012 8:14 AM
  • Found the problem, damn Mcafee real time scanning turned it off and worked ok, turn it on and would not publish.
    Same for me, this has taken 3 hours of my Life.
    • Proposed as answer by Ogonna Tuesday, November 06, 2012 2:47 PM
    Saturday, October 06, 2012 10:18 PM
  • Yes macfee was the problem. Just off thr RT scanning and you will rocks
    • Proposed as answer by Ogonna Tuesday, November 06, 2012 2:47 PM
    Friday, October 19, 2012 8:08 PM
  • Macfee problem for me too !!!!!!

    4 hours spended


    -=NFT=-

    • Proposed as answer by Ogonna Tuesday, November 06, 2012 2:47 PM
    Friday, October 26, 2012 12:33 AM
  • MacAfee was the problem here too...

    Craig, thank you very much....



    Diogo Vieira da Silva

    • Proposed as answer by Ogonna Tuesday, November 06, 2012 2:47 PM
    Friday, October 26, 2012 5:12 PM
  • Found the problem, damn Mcafee real time scanning turned it off and worked ok, turn it on and would not publish.

    Same problem too for my boss and I . Thanks alot.

    McAfee should disable/rollback whatever update that's causing this.

    Tuesday, November 06, 2012 2:49 PM
  • You are GOD Graig i spend 2 weeks to solve this issue
    Monday, November 26, 2012 8:53 AM
  • Found the problem, damn Mcafee real time scanning turned it off and worked ok, turn it on and would not publish.

    Thank you very much!

    this caused me to lose a week

    Friday, November 30, 2012 9:00 AM
  • I just ran into this with VS 2012, for the second time. After wasting an hour or so repairing and such, I noticed that the "Publish" button was now working even though the "Edit Publish Profiles" still produced the error message. I tried publishing to a development server using an existing profile, and it failed with a syntax error in web.config. I fixed that, published again, successfully, and then tried "Edit Publish Profiles" again. This time it worked! Something's really flaky here.

    -Megan

    Wednesday, January 16, 2013 11:37 PM
  • It has also worked for me.

    I don't know what is blocked by Mcafee real time scanning ?

    thx

    Thursday, August 01, 2013 11:21 AM
  • I had the same issue, I just copied the code and published it using another machine having VS 2010 installed. It seems some environmental issue may be anti-virus, or any other program.
    Thursday, September 26, 2013 7:40 PM
  • Just spent 9 hours replacing dll,s and debugging.

    F*c* mcafee

    Wednesday, October 23, 2013 6:31 AM
  • You developers are funny.  You circumvent the problem and dont solve it.  In the real world, Enterprise ePO admins wont let you turn off On-Access Scanner.
    Thursday, May 08, 2014 7:18 PM
  • I actually can't believe I've actually never said this aloud on the 'Net before.

    The same care and feeding that developers have displayed in this forum regarding security concerns is precisely why the world is flooded with their easily exploitable code in the first place.

    Why don't you call your help desk, work with the security team, and arrive at a acceptable security configuration instead of tossing the baby out.  Why else do you think that security software is configurable?...

    Tuesday, May 27, 2014 4:28 PM
  • Hats off to you Craig!

    After spending many days researching for this issue, your solution worked. I tried everything like deleting .compiled files from bin, removing .refresh files, adding references again, upgrading VS 2012 to 2013, nothing worked and the fact of the matter is that I published this website few months ago and nothing has changed since then, no code change, site will build successfully but will not publish with option to make it update-able (publish was working fine without option of making it update-able).

    Culprit was mcafee, I turned that off and now publishing is back to normal. Thanks again.

    Tuesday, July 15, 2014 7:59 PM