none
Visual Studio Content Installer instructions wrt Code Snippets do not seem to work correctly RRS feed

  • Question

    • O/S: Windows 7 (Hard specifications shown at bottom of this post)
    • Visual Studio Windows Phone Express Beta Version WPDTBetaRel 30319.105
    • .NET version: 4.0.30319 RTMREL

    VSI file will not load Code Snippets correctly and indicate an error when using it with the Visual Studio Windows Phone Express, but will load the code snippet to the vb code snippets folder and I only have Visual Web Developer Express 2010.  The only difference is that the attribute lang is set to csharp in the one that throws the exception and the one that works uses lang set to vb.

    If I run the same *.VSI file using lang value= "vb", the code snippet specified  is loaded to Visual Basic Express 2010 code snippet folder, in the path:

    • C:\Users\hillbilly\Documents\Visual Studio 2010\Code Snippets\Visual Basic\My Code Snippets\PlanetDraw.snippet

    When I run the same *.VSI file, using lang value= "csharp", I get an error (which is shown below the vscontent file), stating that the value is null

    When I run a starter kit for C# 2005, the template is loaded correctly and is usable in my Visual Studio Windows Phone Express and works fine (but not for the phone of course), but in that vscontent file, there are no code snippets.

    I have created a simple code snippet, and created a related VS Content with the following code, following the instructions from

    Here is the code/text from my vscontent, codesnippet.snippet:

    <VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
      <Content>
        <FileName>PlanetDraw.snippet</FileName>
        <DisplayName>Planet Draw Snippet</DisplayName>
        <Description>Planet Draw Snippet Example</Description>
        <FileContentType>Code Snippet</FileContentType>
        <ContentVersion>2.0</ContentVersion>
     <Attributes>
         <Attribute name="lang" value="csharp"/>
     </Attributes>

     </Content>
    </VSContent>

     ************** Exception Text **************
    System.ArgumentNullException: Value cannot be null.
    Parameter name: value
       at System.Windows.Forms.ImageList.ImageCollection.Add(Image value)
       at VSContentInstaller.SnippetLanguagePage.SnippetLanguagePage_Load_1(Object sender, EventArgs e)
       at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
       at System.Windows.Forms.UserControl.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.ControlCollection.Add(Control value)
       at Microsoft.WizardFramework.WizardForm.ActivatePage(WizardPage page)
       at Microsoft.WizardFramework.WizardPage.Activate()
       at Microsoft.WizardFramework.WizardForm.OnNext()
       at Microsoft.WizardFramework.WizardForm.OnNextClicked(Object sender, EventArgs e)
       at Microsoft.WizardFramework.NavigationButtonBar.OnNext(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4952 (win7RTMGDR.050727-4900)
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    VSContentInstaller
        Assembly Version: 10.0.0.0
        Win32 Version: 10.0.30319.1
        CodeBase: file:///C:/Program%20Files%20(x86)/Common%20Files/Microsoft%20Shared/MSEnv/VSContentInstaller.exe
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    Microsoft.VisualStudio.VSContentInstaller
        Assembly Version: 8.0.0.0
        Win32 Version: 8.0.50727.42
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.VSContentInstaller/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.VSContentInstaller.dll
    ----------------------------------------
    Microsoft.VisualStudio.Zip
        Assembly Version: 8.0.0.0
        Win32 Version: 8.0.50727.762
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Zip/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Zip.dll
    ----------------------------------------
    System.Xml
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    Microsoft.WizardFramework
        Assembly Version: 8.0.0.0
        Win32 Version: 10.0.30319.1
        CodeBase: file:///C:/Program%20Files%20(x86)/Common%20Files/Microsoft%20Shared/MSEnv/Microsoft.WizardFramework.DLL
    ----------------------------------------

    **********************My hardware and OS: ************************

    OS Name Microsoft Windows 7 Enterprise
    Version 6.1.7600 Build 7600
    Other OS Description  Not Available
    OS Manufacturer Microsoft Corporation
    System Manufacturer Hewlett-Packard
    System Model HP EliteBook 8530w
    System Type x64-based PC
    Processor Intel(R) Core(TM)2 Duo CPU     P9500  @ 2.53GHz, 2534 Mhz, 2 Core(s), 2 Logical Processor(s)
    BIOS Version/Date Hewlett-Packard 68PDV Ver. F.11, 12/8/2009
    SMBIOS Version 2.4
    Windows Directory C:\Windows
    System Directory C:\Windows\system32
    Boot Device \Device\HarddiskVolume3
    Hardware Abstraction Layer Version = "6.1.7600.16385"
    Installed Physical Memory (RAM) 4.00 GB
    Total Physical Memory 3.96 GB
    Available Physical Memory 1.85 GB
    Total Virtual Memory 7.93 GB
    Available Virtual Memory 4.84 GB
    Page File Space 3.96 GB
    Page File C:\pagefile.sys

    • Edited by Sam Stokes Wednesday, August 11, 2010 5:22 PM Formatting
    Wednesday, August 11, 2010 4:58 PM

All replies

  • Hello Sam,

    Thanks for your post.

    Have you changed the language attribute in .snippet file? I notice you only mention you have changed it in .vscontent file.

    And I have tried to reproduce this issue in my side with Visual Studio 2010 Ultimate Edition for I have no Visual Studio Windows Phone Express Edition available. Does it support both VB and C#? I'm not familiar with Windows Phone Express Edition. I suspect the problem is .vsi does not find installed path.

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on 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.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, August 12, 2010 3:20 AM
  • I have attempted to use the vsi file from the Windows Phone Developer tool set and that also threw the same error.  When I changed the language in the vscontent file to "vb", the code snippets loaded into the vb code snippet folder.  When I changed the lang back to "csharp", the error occurred.

    http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ca23285f-bab8-47fa-b364-11553e076a9a 

    The error only occurs with C# Code snippets when Visual Studio for Windows Phone Express is installed, Visual Studio Web Developer (thus setting up the VB code snippet folder along with the related jscript, XML code snippet folders as well).  The C# Code Snippet folder is installed.

    As to the language attribute in the code snippets file, ummm.... nope just checked again:

    </Declarations>
       <Code Language="csharp">

    I was able to successfully install all other files from a vsi created for Visual Studio 2005 C#, but it didn't have code snippets inside of it (from one of the referneced links).

    It might be that the Visual Studio for Windows Phone Express is not setting a registry setting, I have just installed Visual Studio Ultimate 2010 (MSDNAA version) on my system. 

    Version 10.0.30319.1

    After attempting the same test approach with Ultimate now installed, but not used, here are the results:

    • vscontent lang = "csharp" test fails
    • vscontent lang = "vb" test succeeds

    After attempting the same test approach with Ultimate now installed, Ultimate has been opened, the code snippets still threw the error.

    Here is the error output (after Ultimate was installed, but not opened for the first time):

    ************* Exception Text **************
    System.ArgumentNullException: Value cannot be null.
    Parameter name: value
       at System.Windows.Forms.ImageList.ImageCollection.Add(Image value)
       at VSContentInstaller.SnippetLanguagePage.SnippetLanguagePage_Load_1(Object sender, EventArgs e)
       at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
       at System.Windows.Forms.UserControl.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.ControlCollection.Add(Control value)
       at Microsoft.WizardFramework.WizardForm.ActivatePage(WizardPage page)
       at Microsoft.WizardFramework.WizardPage.Activate()
       at Microsoft.WizardFramework.WizardForm.OnNext()
       at Microsoft.WizardFramework.WizardForm.OnNextClicked(Object sender, EventArgs e)
       at Microsoft.WizardFramework.NavigationButtonBar.OnNext(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4952 (win7RTMGDR.050727-4900)
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    VSContentInstaller
        Assembly Version: 10.0.0.0
        Win32 Version: 10.0.30319.1
        CodeBase: file:///C:/Program%20Files%20(x86)/Common%20Files/Microsoft%20Shared/MSEnv/VSContentInstaller.exe
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    Microsoft.VisualStudio.VSContentInstaller
        Assembly Version: 8.0.0.0
        Win32 Version: 8.0.50727.42
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.VSContentInstaller/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.VSContentInstaller.dll
    ----------------------------------------
    Microsoft.VisualStudio.Zip
        Assembly Version: 8.0.0.0
        Win32 Version: 8.0.50727.762
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Zip/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Zip.dll
    ----------------------------------------
    System.Xml
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    Microsoft.WizardFramework
        Assembly Version: 8.0.0.0
        Win32 Version: 10.0.30319.1
        CodeBase: file:///C:/Program%20Files%20(x86)/Common%20Files/Microsoft%20Shared/MSEnv/Microsoft.WizardFramework.DLL
    ----------------------------------------


    ADE
    Thursday, August 12, 2010 7:58 PM
  • Hello,

    Sorry for the delay.

    Could you post your code in .snippet file? You just post the code in .vscontent file.

    And for your reference, please see: How to publish code snippets .

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on 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.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, August 18, 2010 6:52 AM
  • Hello,

    Does this issue solved? If not, could you please update this thread. Thanks.

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on 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.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, September 16, 2010 9:16 AM
  • Hello, I'm having the exact same problem, and I also have the Windows Phone Developer Tools installed.  My coworker who does not have the Windows Phone Developer Tools installed is able to run the .vsi file without any problems.

    Here is what my .vscontent file looks like:

    <?xml version="1.0" encoding="utf-8"?>
    <VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005">
    	<Content>
    		<FileName>DependencyProperty.snippet</FileName>
    		<DisplayName>Dependency Property Snippet</DisplayName>
    		<Description>A code snippet for making dependency properties.</Description>
    		<FileContentType>Code Snippet</FileContentType>
    		<ContentVersion>2.0</ContentVersion>
    		<Attributes>
    			<Attribute name="lang" value="csharp"/>
    		</Attributes>
    	</Content>
    	<Content>
    		<FileName>DependencyPropertyVB.snippet</FileName>
    		<DisplayName>Dependency Property Snippet VB</DisplayName>
    		<Description>A code snippet for making dependency properties in VB.</Description>
    		<FileContentType>Code Snippet</FileContentType>
    		<ContentVersion>2.0</ContentVersion>
    		<Attributes>
    			<Attribute name="lang" value="vb"/>
    		</Attributes>
    	</Content>
    </VSContent>
    


    and here are the corresponding snippet files:

    <?xml version="1.0" encoding="utf-8"?>
    <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
      <CodeSnippet Format="1.0.0">
        <Header>
          <SnippetTypes>
            <SnippetType>Expansion</SnippetType>
          </SnippetTypes>
          <Title>DependencyProperty</Title>
          <Author>Dan Schroeder</Author>
          <Description>Creates a new dependency property.</Description>
          <HelpUrl>
          </HelpUrl>
          <Shortcut>dp</Shortcut>
        </Header>
        <Snippet>
          <Declarations>
            <Literal Editable="true">
              <ID>Name</ID>
              <ToolTip>The property's Name</ToolTip>
              <Default>Name</Default>
              <Function>
              </Function>
            </Literal>
            <Literal Editable="true">
              <ID>NameType</ID>
              <ToolTip>The property's Type</ToolTip>
              <Default>NameType</Default>
              <Function>
              </Function>
            </Literal>
            <Literal Editable="true">
              <ID>ParentClass</ID>
              <ToolTip>The class that contains this property</ToolTip>
              <Default>ParentClass</Default>
              <Function>
              </Function>
            </Literal>
            <Literal Editable="true">
              <ID>DefaultValue</ID>
              <ToolTip>The property's default value</ToolTip>
              <Default>DefaultValue</Default>
              <Function>
              </Function>
            </Literal>
          </Declarations>
          <Code Language="csharp"><![CDATA[public $NameType$ $Name$
    {
    	get { return ($NameType$)GetValue($Name$Property); }
    	set { SetValue($Name$Property, value); }
    }
    public static readonly DependencyProperty $Name$Property = DependencyProperty.Register("$Name$", typeof($NameType$), typeof($ParentClass$), new UIPropertyMetadata($DefaultValue$));]]></Code>
        </Snippet>
      </CodeSnippet>
    </CodeSnippets>
    

    <?xml version="1.0" encoding="utf-8"?>
    <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
      <CodeSnippet Format="1.0.0">
        <Header>
          <SnippetTypes>
            <SnippetType>Expansion</SnippetType>
          </SnippetTypes>
          <Title>SnippetFile1</Title>
          <Author>iQuser</Author>
          <Description>Creates a new dependency property.</Description>
          <HelpUrl>
          </HelpUrl>
          <Shortcut>dp</Shortcut>
        </Header>
        <Snippet>
          <Declarations>
            <Literal Editable="true">
              <ID>Name</ID>
              <ToolTip>Name</ToolTip>
              <Default>Name</Default>
              <Function>
              </Function>
            </Literal>
            <Literal Editable="true">
              <ID>NameType</ID>
              <ToolTip>NameType</ToolTip>
              <Default>NameType</Default>
              <Function>
              </Function>
            </Literal>
            <Literal Editable="true">
              <ID>ParentClass</ID>
              <ToolTip>ParentClass</ToolTip>
              <Default>ParentClass</Default>
              <Function>
              </Function>
            </Literal>
            <Literal Editable="true">
              <ID>DefaultValue</ID>
              <ToolTip>DefaultValue</ToolTip>
              <Default>DefaultValue</Default>
              <Function>
              </Function>
            </Literal>
          </Declarations>
          <Code Language="vb"><![CDATA[Private Property $Name$() As $NameType$
    	Get
    		Return CType(GetValue($Name$Property), $NameType$)
    	End Get
    	Set(ByVal value As $NameType$)
    		SetValue($Name$Property, value)
    	End Set
    End Property
    Public Shared ReadOnly $Name$Property As DependencyProperty = DependencyProperty.Register("$Name$", GetType($NameType$), GetType($ParentClass$), New PropertyMetadata($DefaultValue$))]]></Code>
        </Snippet>
      </CodeSnippet>
    </CodeSnippets>
    
    Any help would be appreciated.  I am using Visual Studio Ultimate 2010 SP1 along with the Windows Phone SDK 7.1 (Beta2).  Also, not sure if it's relevant, but I also have the XNA Game Studio 3.1 and 4 installed too. Thanks.

     

     

     


    - Dan - "Can't never could do anything"
    Tuesday, September 6, 2011 10:30 PM
  • Not resolved
    Fix the documentation
    Tuesday, September 13, 2011 4:45 PM
  • Did anybody find a fix?

    It seems that the issue appears with any vsi which deploy a snippet for C#

    Monday, June 11, 2012 10:40 AM
  • Confirming it must be something with windows phone SDK - the same VSI works fine with Visual Studio 2010 on a machine without the windows phone toolkit. I may try uninstalling the Windows Phone SDK later on to see if it resolves the issue.
    Wednesday, July 18, 2012 9:20 PM
  • Still no answer for Visual Studio 2010.  Need to check this in VS 12, but it may work since there is no Windows Phone Component.

    Sam Stokes

    Wednesday, July 18, 2012 10:48 PM