4

Closed

File not found errors when compiling large projects

description

When compiling a large project error messages under Visual Studio 2012 on Windows 8 are generated stating that files cannot be found. The error messages contain incorrect paths to the files. The paths that are displayed in the error messages are missing a single character.

The error messages are one of the following:

Error reading file "<< file name >> ": File not found
Unknown extension for file: "<< file name >>". Only .ts and .d.ts extensions are allowed.

I have traced this back through the compiler source code and tracked it down to a problem with the WScript host library. It looks like this library is passing a corrupted command line to the script from the WScript.Arguments property. It looks like a single character is being removed from the command line every 8192 characters. This suggests some kind of buffer bug in the WScript library. I am using version 5.8.9200.16384 of the windows script host runtime library.

To reproduce this create a set of Typescript classes, one in each file and then place them down a deep folder structure with long file names. This will generate a long command line that will then show the problem.

file attachments

Closed Feb 20, 2013 at 5:42 PM by RyanCavanaugh
Closing since we have a work-around for now. We'll be rewriting how the project file works to have a proper msbuild task that will fix this and other issues (e.g. non-ascii characters in file paths).

comments

RyanCavanaugh wrote Jan 4, 2013 at 8:32 PM

Very odd; marking 'active'. You can probably invoke tsc.js through node as a work-around in the meantime. Thanks for reporting this.

rozentalsn wrote Jan 8, 2013 at 1:52 AM

We are having exactly the same issue, on Windows 7.

It seems that the compiler is dropping random characters from the file name path.
( C:\source becomes C:\ource), generating a FileNotFound error.

JuliusOnCodePlex wrote Jan 21, 2013 at 8:34 AM

We see something similar, but I am not sure it is the same. See this [stack overflow question].(http://stackoverflow.com/questions/14397972/compiling-many-typescript-files-at-once)

RyanCavanaugh wrote Feb 4, 2013 at 6:16 PM

I've added a work-around Microsoft.TypeScript.targets file that should work with projects created with 0.8.2.0 or later. Just back up your existing one (in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript) and overwrite with the attached. Let me know if this helps. Thanks!

RyanCavanaugh wrote Feb 4, 2013 at 7:30 PM

Updated version that supports paths with spaces in them

ben_voss wrote Feb 5, 2013 at 8:59 AM

Ryan,

Yes that works. I had to cut and paste the same build instruction changes into the "BeforeBuild" target at the end of my project file but then things look like they are working properly.

Nice way to side step the problem - by writing the build command to a file and then just passing the one file of command line to the compiler. Good lateral thinking.

Will this patch make its way into an upcoming release?

Thanks.

parliament718 wrote Mar 23, 2013 at 11:07 AM

Ryan your fix did not work for me. My issue is described here. http://typescript.codeplex.com/workitem/836

Thanks

Grajkowski wrote Jun 7, 2013 at 12:59 AM

@Ryan Did a fix for this make it into the 0.9 beta release, or will I need to modify the targets file again?

NTaylorMullen wrote Jun 29, 2013 at 3:34 AM

Any update on when this will make it into the primary TypeScript build? I'm forced to replace my TypeScript targets file on every upgrade and anyone who downloads the source of my project cannot build it because they do not have the modification.

Guess for the interim i'll just have to check the typescript targets file in.

Btw I'm using typescript 0.9.1

ca0v wrote Jun 29, 2013 at 6:28 AM

When?

Closing since we have a work-around for now. We'll be rewriting how the project file works to have a proper msbuild task that will fix this and other issues (e.g. non-ascii characters in file paths).

RyanCavanaugh wrote Aug 13, 2013 at 8:10 PM

This is fixed in TypeScript 0.9.1.0