none
VS 2010 SP1, ASP.NET Controls - Error Creating (Object reference not set)

    Question

  • Using VS 2010 SP1, I am unable to add controls from the ASP.NET Toolbox to a web form using Microsoft.NET 4.x. When I add a standard control (e.g <ASP:BUTTON>), I get "Error creating Control", "Object reference not set to an instance of an object". This error only occurs w .NET 4.x.  I am able to add controls using 3.5.

    Background: I noticed this problem after installing Win 7 SP1.  I had fits installing Win 7 SP1. I finally ending up repairing my Win 7 before I could install SP 1.  After installing Win 7 SP1, I installed numerous updates to the system.

    Then, I discovered that VS 2010 was broken.  I finally installed VS 2010 SP1, after failing (many times). To succeed, I performed a total uninstall of VS 2010 (using VS2010_Uninstall-RTM.ENU.exe).  I repaired VS 2010. I installed Microsoft.NET update NDP40-KB2468871-v2-x86.exe (before VS 2010 SP1 because it kept hanging SP1).  Then, I installed VS 2010 SP1.

    Now, the Microsoft.NET Framework 4 has problems.  I have reset the Toolbox numerous times (Toolbox | Reset Toolbox) and (Tools | Choose Toolbox Items | Reset). I have the error under Target Frameworks ".NET Framework 4" and ".NET Framework 4 Platform Update 1 (KB2478063)".  Under Framework 4, web controls are version 4.0.0.0 (and 4.0.1.0 under Update 1). (Choose Toolbox items indicates that the toolbox items point to the GAC).

    VS 2010 info indicates VS 2010 indicates:

    Microsoft Visual Studio 2010
    Version 10.0.40219.1 SP1Rel
    Microsoft .NET Framework
    Version 4.0.30319 SP1Rel

    Installed Version: Professional

    Microsoft Office Developer Tools   01018-587-3135277-70019
    Microsoft Office Developer Tools

    Microsoft Visual Basic 2010   01018-587-3135277-70019
    Microsoft Visual Basic 2010

    Microsoft Visual C# 2010   01018-587-3135277-70019
    Microsoft Visual C# 2010

    Microsoft Visual C++ 2010   01018-587-3135277-70019
    Microsoft Visual C++ 2010

    Microsoft Visual F# 2010   01018-587-3135277-70019
    Microsoft Visual F# 2010

    Microsoft Visual Studio 2010 Team Explorer   01018-587-3135277-70019
    Microsoft Visual Studio 2010 Team Explorer

    Microsoft Visual Web Developer 2010   01018-587-3135277-70019
    Microsoft Visual Web Developer 2010

    Crystal Reports Templates for Microsoft Visual Studio 2010  
    Crystal Reports Templates for Microsoft Visual Studio 2010

    Hotfix for Microsoft Visual Studio 2010 Professional - ENU (KB2542054)   KB2542054
    This hotfix is for Microsoft Visual Studio 2010 Professional - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/2542054.

    Microsoft Visual Studio 2010 Professional - ENU Service Pack 1 (KB983509)   KB983509
    This service pack is for Microsoft Visual Studio 2010 Professional - ENU.
    If you later install a more recent service pack, this service pack will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/983509.

    Microsoft Visual Studio 2010 SharePoint Developer Tools   10.0.40219
    Microsoft Visual Studio 2010 SharePoint Developer Tools

    Update for Microsoft Visual Studio 2010 Professional - ENU (KB2495593)   KB2495593
    This update is for Microsoft Visual Studio 2010 Professional - ENU.
    If you later install a more recent service pack, this update will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/2495593.

    Thanks in advance for your help.

    • Moved by Andrew.Wu Friday, July 15, 2011 8:03 AM (From:Visual Studio Setup and Installation)
    Monday, July 11, 2011 1:57 PM

All replies

  • Hi DeadlyDirk,

    Welcome to the MSDN Forum.

    According to your description, it appears that the .NET Framework 4.0 has corrupted. I would like to recommand you using this tool: .NET Framework Setup Verification Tool to verify the installation status of your .NET Framework 4.0 first. If the tool reports verify failed, please download and reinstall .NET Framework via this link: http://www.microsoft.com/download/en/details.aspx?id=17718

    Additionally, you can perform the common troubleshooting methods below:

    • Open Visual Studio Command Prompt (2010) under Start menu -> All Programs -> Microsoft Visual Studio 2010  -> Visual Studio Tools (run it with Administrator privilege: right-click the program -> Run as administrator);
    • Enable Visual Studio logging to log all activity to the specified log path.
      Please running devenv.exe /log <log path> in Command Prompt, the log files will be generated in the <log path>. Then you can check and analyze the log file to see if there are anything incorrect.
    • Run devenv /Resetsettings to eliminate the cause of corrupted settings;
    • Run devenv /ResetSkipPkgs in Command Prompt;
    • Run devenv /Safemode to see if you can apply it correctly. This can eliminate the possibility that third party Add-ins or packages are causing problems.
    • Reboot the machine in Safe Mode. This can isolate some third party application/driver's interference;
    • Switch and try a new user account. This can rule out the possibility of corrupted user profile

    If there are any updates, pelase feel free to let me know.

    Best Regards,


    Andrew Wu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, July 14, 2011 7:44 AM
  • ADDITIONAL INFO

    Under 3.5, if I add a button control, VS adds an assembly reference to web.config; and I can see the referenced object in the Object Browser (browsing the solution). 

    Under 4.x, if I add a button control, VS adds NO assembly reference to web.config; and I CANNOT see the referenced object in the Object Browser.  However, if I select the object (button) in the designer, i can see its Properties (e.g ID) in the Properties window.

     

    Thursday, July 14, 2011 7:37 PM
  • NET 4 verifies out and I tried all of the above with no improvement.  (FYI: I'm a computer veteran and not a newbie, for what it's worth.)

    It seems like there's some disconnect between the VS design environment and NET 4.  Is there some installation (design, tools, etc.) we can try repairing? 

    Thursday, July 14, 2011 7:50 PM
  • Hi DeadlyDirk,

    I appericate your response and update. It seems that this issue is more related with Visual Studio ASP.NET features, I would like to redirect you to the dedicate ASP.NET Forum: http://forums.asp.net/ for more efficient response.

    Thanks for your understanding.

    Best Regards,


    Andrew Wu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, July 15, 2011 8:02 AM