locked
Corrupted files RRS feed

  • Question

  • Hi,

    I am writing a visual studio add-in to support a custom language(syntax highlighting and project support) and I have some issues when I try to create a new project because most of the files of my template project are corrupted. For example my png files are different from original :

    this is the original file found inside C:\Users\Joe\AppData\Local\Microsoft\VisualStudio\10.0Exp
    \Extensions\Smartmobili\ObjjTools\1.1\Skel\Projects\~PC\ObjjPrj\
    ObjjPrj.zip\Frameworks\AppKit\Resources

    

    and here is the file once I have created a new project for the custom language in 
    C:\Users\Joe\Documents\Visual Studio 2010\CappApplication11\Frameworks\AppKit\Resources

    What can happen between the cached files inside C:\Users\Joe\AppData\Local\Microsoft\VisualStudio\10.0Exp\Extensions and the folder where I want to create a new project (Documents in this example) ?

    Is there more than just a simple copy ?




    • Edited by Vincent Rich Wednesday, October 17, 2012 7:41 AM
    Tuesday, October 16, 2012 6:32 PM

Answers

  • Hi Vincent,

    After looking at your project, the problem is internal to your project system code and I'll respond to you offline where the problem is.

    Essentially during the call to your IVsAggregatableProject::InitializeForOuter where you're copying over the project asset files, you have a call to determine if the file to be copied is binary or not and you do additional processing for non-binary files, thereafter writing the file out to the target directory. That's when the file gets corrupted.

    Thanks

    Elisha

    • Proposed as answer by Kendagor Thursday, October 25, 2012 12:40 AM
    • Marked as answer by Vincent Rich Thursday, October 25, 2012 12:42 PM
    Thursday, October 25, 2012 12:34 AM

All replies

  • Hi Vincent,

    When you create a new project, it will create a prject acrooding the defination in the .*proj file.

    How do you define your .*proj file? Are all files in your project corrupted?

    >Is there more than just a simple copy ?

    I think so. I think it will be create as your setting.

    Here is an article about Creating a Basic Project System which you can read:

    http://msdn.microsoft.com/en-us/library/cc512961.aspx

    Best regards,


    Ego [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, October 17, 2012 8:00 AM
  • Actually all my binary files are corrupted, text files are ok.

    Here is an extract of my package files :

    1) ObjjProject.objjproj:

    <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>$guid1$</ProjectGuid>
        <ProjectHome>.</ProjectHome>
        <StartupFile>index.html</StartupFile>
        <SearchPath></SearchPath>
        <WorkingDirectory>.</WorkingDirectory>
        <OutputPath>.</OutputPath>
      </PropertyGroup>
      <!-- There are no properties for these groups.  AnyCPU needs to appear in
           order for Visual Studio to perform the build.-->
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
      </PropertyGroup>
    
      <ItemGroup>
        <Folder Include="Resources\" />
        <Folder Include="Properties\" />
      </ItemGroup>
      
      <ItemGroup>
        <Content Include="AppController.j"></Content>
        <Content Include="index.html"></Content>
        <Content Include="Info.plist"></Content>
        <Content Include="main.j"></Content>
        <Compile Include="Program.cs"></Compile>
        <Compile Include="Properties\AssemblyInfo.cs"></Compile>
        <Content Include="Resources\spinner.gif"></Content>
      </ItemGroup>
      
      <ItemGroup>
        <Reference Include="System" />
        <Reference Include="System.Core" />
        <Reference Include="Microsoft.CSharp" />
      </ItemGroup>
      <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    </Project>

    2) ObjjProject.vstemplate:

    <VSTemplate Version="2.0.0" Type="Project" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
      <TemplateData>
        <Name>Cappuccino Web Application</Name>
        <Description>A project for creating a Cappuccino web application</Description>
        <Icon>ObjjProject.ico</Icon>
        <ProjectType>Objj</ProjectType>
        <SortOrder>50</SortOrder>
        <NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
        <CreateNewFolder>false</CreateNewFolder>
        <DefaultName>CappApplication</DefaultName>
        <ProvideDefaultName>true</ProvideDefaultName>
      </TemplateData>
      <TemplateContent>
        <Project File="ObjjProject.objjproj" ReplaceParameters="true">
          <ProjectItem ReplaceParameters="true" OpenInEditor="false">index.html</ProjectItem>
          <ProjectItem ReplaceParameters="true" OpenInEditor="true">main.j</ProjectItem>
          <ProjectItem ReplaceParameters="true" OpenInEditor="true">AppController.j</ProjectItem>
          <ProjectItem ReplaceParameters="true" OpenInEditor="false">Info.plist</ProjectItem>
          <ProjectItem ReplaceParameters="true" OpenInEditor="false">Program.cs</ProjectItem>
          <ProjectItem>Properties\AssemblyInfo.cs</ProjectItem>
          <ProjectItem>Resources\spinner.gif</ProjectItem>
        </Project>
      </TemplateContent>
    </VSTemplate>

    Actually my project is based on a c# project with a dummy Program.cs that is compiled and when user click on start debugging I intercept LaunchDebug to start a web server.
    But still doesn 't explain why all my binary files are corrupted.

    In the sample I gave above, the file Resources\spinner.gif is corrupted.



    • Edited by Vincent Rich Wednesday, October 17, 2012 8:05 PM
    Wednesday, October 17, 2012 5:58 PM
  • Can you try placing ReplaceParameters="false" on the spinner.gif node? That should be the default, but if ReplaceParameters isn't active, from what people who know this area tell me, then the copy should just be literally a copy, so it almost seems as if it is going down the 'replace parameters' path for the GIF file, which doesn't make much sense...but it could be a bug. Trying to set it explicitly may counteract it, though giving us a complete repro we could troubleshoot locally would be helpful if that doesn't work.

    Ryan


    Wednesday, October 17, 2012 9:16 PM
  • Still doesn't work.

    How can I send you my project ? I have removed parts I don't want to share and unfortunately now when I create a new project there is some issue when I want to open one of the file inside ide but it's not too bad because you can see that the Resources\spinner.gif is corrupted.

    Thursday, October 18, 2012 5:38 PM
  • You can send it to rmolden AT <obvious company name here> DOT com, I can attach it to a bug so that someone can try reproing it and digging into why it is happening (I know nothing about this area, so I can't offer much insight).

    Ryan

    Thursday, October 18, 2012 5:49 PM
  • Done.

    Thursday, October 18, 2012 7:39 PM
  • I've received your attachment. Just to be sure, you're using VS 2010 SP1 right?

    Elisha

    Friday, October 19, 2012 8:41 PM
  • Yes I am using Windows 7 64 bit and VS2010 SP1.
    In the sample I have sent you should comment the following line in C:\ObjjTools_Bug\Smi.VisualStudio.Language.Objj\ObjjLanguagePackage.cs to avoid some freeze :

    [ProvideLanguageExtension(typeof(ObjjLanguageInfo), PkgConstants.FileExtension1)]

    because I have removed the language classifier but I forgot to remove this definition.

    To test, select Smi.VisualStudio.Language.Objj as the startup project and then create a new project inside the experimental instance :
    Images intégrées 3
    Once the project is created  go to the location where the project have been created and have a look at the  Resources\spinner.gif.


    Here is infomation about my Visual Studio : 

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

    Installed Version: Ultimate

    Microsoft Office Developer Tools   01019-532-2002102-70838
    Microsoft Office Developer Tools

    Microsoft Visual Basic 2010   01019-532-2002102-70838
    Microsoft Visual Basic 2010

    Microsoft Visual C# 2010   01019-532-2002102-70838
    Microsoft Visual C# 2010

    Microsoft Visual C++ 2010   01019-532-2002102-70838
    Microsoft Visual C++ 2010

    Microsoft Visual F# 2010   01019-532-2002102-70838
    Microsoft Visual F# 2010

    Microsoft Visual Studio 2010 Architecture and Modeling Tools   01019-532-2002102-70838
    Microsoft Visual Studio 2010 Architecture and Modeling Tools

    UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

    Microsoft Visual Studio 2010 Code Analysis Spell Checker   01019-532-2002102-70838
    Microsoft Visual Studio 2010 Code Analysis Spell Checker

    Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

    The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

    Microsoft Visual Studio 2010 Team Explorer   01019-532-2002102-70838
    Microsoft Visual Studio 2010 Team Explorer

    Microsoft Visual Web Developer 2010   01019-532-2002102-70838
    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 Ultimate - ENU (KB2529927)   KB2529927
    This hotfix is for Microsoft Visual Studio 2010 Ultimate - 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/2529927.

    Hotfix for Microsoft Visual Studio 2010 Ultimate - ENU (KB2548139)   KB2548139
    This hotfix is for Microsoft Visual Studio 2010 Ultimate - 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/2548139.

    Hotfix for Microsoft Visual Studio 2010 Ultimate - ENU (KB2549864)   KB2549864
    This hotfix is for Microsoft Visual Studio 2010 Ultimate - 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/2549864.

    Hotfix for Microsoft Visual Studio 2010 Ultimate - ENU (KB2565057)   KB2565057
    This hotfix is for Microsoft Visual Studio 2010 Ultimate - 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/2565057.

    Hotfix for Microsoft Visual Studio 2010 Ultimate - ENU (KB2635973)   KB2635973
    This hotfix is for Microsoft Visual Studio 2010 Ultimate - 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/2635973.

    Hotfix for Microsoft Visual Studio 2010 Ultimate - ENU (KB2736182)   KB2736182
    This hotfix is for Microsoft Visual Studio 2010 Ultimate - 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/2736182.

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

    Microsoft Visual Studio 2010 Ultimate - ENU Service Pack 1 (KB983509)   KB983509
    This service pack is for Microsoft Visual Studio 2010 Ultimate - 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.

    PowerCommands for Visual Studio 2010   1.0
    A set of power commands for Visual Studio 2010

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

    VMDebugger
    For more information about VMware Inc, see their website at
    http://www.vmware.com
    Copyright (c) 2011 VMware, Inc.

        

    Saturday, October 20, 2012 7:30 AM
  • I was able to reproduce the issue and now investigating it. I'll prepare a response asap.

    Thanks

    Elisha

    Tuesday, October 23, 2012 7:00 PM
  • Hi Vincent,

    After looking at your project, the problem is internal to your project system code and I'll respond to you offline where the problem is.

    Essentially during the call to your IVsAggregatableProject::InitializeForOuter where you're copying over the project asset files, you have a call to determine if the file to be copied is binary or not and you do additional processing for non-binary files, thereafter writing the file out to the target directory. That's when the file gets corrupted.

    Thanks

    Elisha

    • Proposed as answer by Kendagor Thursday, October 25, 2012 12:40 AM
    • Marked as answer by Vincent Rich Thursday, October 25, 2012 12:42 PM
    Thursday, October 25, 2012 12:34 AM