locked
VS 2010 Snippets not working RRS feed

  • Question

  • I have a problem with VS 2010 snippets not working. When I go to type the snippet info (example: #region or prop or propdp, etc) intellisense does not recognize any of the snippets. If I use Ctrl K + Ctrl X and type in, I get an error "Object Reference is not set to an instance".

    I have repaired and reinstalled VS 2010 RTM. I have verified the snippets do exist and have permissions to the snippet folder.

    I had Vs 2010 Beta 2 and RC installed previously(snippets worked in both) and did uninstall both per Vs 2010 RTM readme.

    Anyone have any ideas on how to get the snippets working again?

    Tuesday, April 20, 2010 10:18 AM

Answers

  • Hello,

    I would suggest you run the command line devenv /resetuserdata switch to reset Visual Studio to out-of-box state. If the issue is related to any VS configurations or settings, or profile corrupted. This command should fix it.

    For detailed steps, please refer to the last section in this documentation,

    http://msdn.microsoft.com/en-us/library/bb245788(VS.80).aspx (Although it is titled as VS 2005, this command switch works for VS 2010 too).

    If this still does not fix the issue, I think some steps in the installation may be bad. You may try to post in the Visual Studio Installation forum to see if experts there can share ideas on this.

     

    Best regards,
    Ji Zhou
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, April 27, 2010 9:48 AM
    Moderator
  • Are you still getting an error or does IS just not pop up?  Does it work for other languages like VB?  Confirm your settings for Tools\Options -> Text Editor\C# -> Intellisense.  Use Code Snippt Manager to confirm the directories being used for C# are correct.

    Michael Taylor - 4/26/2010
    http://msmvps.com/blogs/p3net

    Monday, April 26, 2010 9:12 PM
    Moderator

All replies

  • AFAIK the #region snippet is a surround snippet so it won't show up as an option when you type #region.  However prop and propdp are valid.  If you type Ctrl K,X then you'll get the IS list.  "in" doesn't map to anything in my version.  But if you are getting an error when you try to use the snippets then your installation or snippet files are bad.  It could just be a bad snippet file.  Are you using custom snippets?  Try renaming your local Snippet directory and see if the problem goes away.  You'll want to restart VS.  Can you open the Code Snippet Manager and browse the snippet files?

    Michael Taylor - 4/20/2010
    http://msmvps.com/blogs/p3net

    Tuesday, April 20, 2010 1:36 PM
    Moderator
  • I am using all the built in snippets for Visual Studio 2010, no custom ones. These were installed with the product. I have tried to remove the local snippet directory (even changing it) and still have the problem. I can open the Code Snippet Manager and browse the snippet files without a problem.

    The #region is a valid snippet (http://msdn.microsoft.com/en-us/library/z41h7fat.aspx) and does work in Visual studio 2008 and 2010 (beta and RC). This is neither here nor there. I am just trying to get the basic snippets working.

    Thanks

    Tuesday, April 20, 2010 1:45 PM
  • More notes, hoping someone can help.

     

    Using the Shortcut key for inserting a snippet does not give the intellisense (ie. the folders from the snipper manager). I have removed VS 2010 completely and reinstalled and still same problem. I have used the DVD to install on a different clean machine (no VS) and everything works properly. The installation was with the same components.

    help please. if there is any more info someone needs to help resolve this please let me know.

    Monday, April 26, 2010 6:07 PM
  • Are you still getting an error or does IS just not pop up?  Does it work for other languages like VB?  Confirm your settings for Tools\Options -> Text Editor\C# -> Intellisense.  Use Code Snippt Manager to confirm the directories being used for C# are correct.

    Michael Taylor - 4/26/2010
    http://msmvps.com/blogs/p3net

    Monday, April 26, 2010 9:12 PM
    Moderator
  • Hello Taylor,

    The snippets do not work under any language and yes the intellisense in the tools-> options is set. Do you happen to know what the DLL or exe used for the intellisense and snippets?

    Thanks a million.

     

    Monday, April 26, 2010 11:05 PM
  • Hello,

    I would suggest you run the command line devenv /resetuserdata switch to reset Visual Studio to out-of-box state. If the issue is related to any VS configurations or settings, or profile corrupted. This command should fix it.

    For detailed steps, please refer to the last section in this documentation,

    http://msdn.microsoft.com/en-us/library/bb245788(VS.80).aspx (Although it is titled as VS 2005, this command switch works for VS 2010 too).

    If this still does not fix the issue, I think some steps in the installation may be bad. You may try to post in the Visual Studio Installation forum to see if experts there can share ideas on this.

     

    Best regards,
    Ji Zhou
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, April 27, 2010 9:48 AM
    Moderator
  • Hello Ji,

     

    thanks a million. This worked. Also removed any setup and addins but that was expected. After using the /resetuserdata I used Taylors information to verify that the snippets showed correctly in the snippet manager and the options set properly so now the snippets work properly.

    this accomplished what 3 complete VS uninstalls could not, so I am curious where the user data for Visual Studio is and why this did not get removed during any of the VS 2010 uninstallation.

    Thanks to you and Taylor for the assistance.

    Thanks,

    Consulting Mechanic

    Tuesday, April 27, 2010 3:11 PM
  • Glad to here it works! :-)

     

    Best regards,
    Ji Zhou
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, April 28, 2010 3:08 AM
    Moderator