none
Code Snippets not working

    Question

  • I have a code snippet that has been working with previous versions of Visual Studio. But with VS 2015 it no longer works.

    When I type the shortcut I get a message box that says: "The operation cannot be competed. Unspecified error". If I remove the "<Shortcut>" tag, the error message goes away, but the snippet does not expand.

    Here is the code for the snippet:

    <?xml version="1.0" encoding="utf-8" ?>
    <CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    	<CodeSnippet Format="1.0.0">
    		<Header>
    			<Title>Property Notify Change</Title>
    			<Shortcut>propdwj</Shortcut>
    			<Description>Code snippet for property and backing field</Description>
    			<Author>Dan Jurden</Author>
    			<SnippetTypes>
    				<SnippetType>Expansion</SnippetType>
    			</SnippetTypes>
    		</Header>
    		<Snippet>
    			<Declarations>
    				<Literal>
    					<ID>desc</ID>
    					<ToolTip>Property description</ToolTip>
    					<Default>Description</Default>
    				</Literal>
    				<Literal>
    					<ID>type</ID>
    					<ToolTip>Property type</ToolTip>
    					<Default>int</Default>
    				</Literal>
    				<Literal>
    					<ID>property</ID>
    					<ToolTip>Property name</ToolTip>
    					<Default>MyProperty</Default>
    				</Literal>
    				<Literal>
    					<ID>field</ID>
    					<ToolTip>The variable backing this property</ToolTip>
    					<Default>myVar</Default>
    				</Literal>
    			</Declarations>
    			<Code Language="CSharp"><![CDATA[/// <summary>
    	/// $desc$
    	/// </summary>
    	public $type$ $property$
    	{
    		get { return _$field$;}
    		set 
    		{ 
    			_$field$ = value;
    			NotifyPropertyChanged("$property$");
    		}
    	}
    	private $type$ _$field$;	
    	$end$]]>
    			</Code>
    		</Snippet>
    	</CodeSnippet>
    </CodeSnippets>

    Any ideas on what is wrong?


    • Edited by Djurden Thursday, April 20, 2017 4:31 PM
    Thursday, April 20, 2017 4:26 PM

Answers

All replies

  • Really weird. I just exited and restarted Visual Studio...now it works! It has not worked the last several weeks!

    Oh well...it's working now!

    Thursday, April 20, 2017 4:55 PM
  • Hi Djurden,

    Glad to know that it works well, thanks for your sharing.

    As you said that it works after you restart the VS, maybe it has a loaded issue for the code Snippets in VS. 

    Anyway, since it works well now, you could mark it as the answer, so we could close this case for you.

    Thank you for your support and co-operation.

    Sincerely,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 21, 2017 2:23 AM
    Moderator