TypeScript Version: 2.0.0
I'm running MSBuild From VS2015 Update 3 with a large TypeScript Project.
The following is in csproj (tried 2.0 too):
<TypeScriptToolsVersion>1.9</TypeScriptToolsVersion>
tsconfig:
{
"compilerOptions": {
"noImplicitAny": false,
"removeComments": false,
"preserveConstEnums": true,
"target": "es5",
"sourceMap": false,
"experimentalDecorators": true,
"pretty": true,
"noEmitOnError": false
},
"compileOnSave": true,
"files": [
// many files
]
}
Expected behavior:
Successful compilation. I can get it to compile on one machine, but not another.
Actual behavior:
[16:16:28]Unknown output : Script failed with error : 'JsErrorScriptException (0x30001)'. [R:\BuildAgent\work\Core.csproj]
[16:16:28]Unknown output : error : Incorrect function. [R:\BuildAgent\work\Core.csproj]
Some more info:
Error: Incorrect function.
at ChakraHost.realpath (Unknown script code:1538:70)
at ts.sys.realpath (Unknown script code:36513:62)
at nodeModuleNameResolver (Unknown script code:36261:13)
at resolveModuleName (Unknown script code:36058:17)
at loader_1 (Unknown script code:36630:68)
at loadWithLocalCache (Unknown script code:36576:17)
at resolveModuleNamesWorker (Unknown script code:36631:81)
at processImportedModules (Unknown script code:37357:17)
at findSourceFile (Unknown script code:37281:17)
at processSourceFile (Unknown script code:37201:22)
Full Visual Studio Info:
Microsoft Visual Studio Community 2015
Version 14.0.25420.01 Update 3
Microsoft .NET Framework
Version 4.6.01055
Installed Version: Community
Visual Basic 2015 00322-20000-00000-AA159
Microsoft Visual Basic 2015
Visual C# 2015 00322-20000-00000-AA159
Microsoft Visual C# 2015
Visual C++ 2015 00322-20000-00000-AA159
Microsoft Visual C++ 2015
Application Insights Tools for Visual Studio Package 1.0
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2015.1 (Beta8) 14.1.11107.0
ASP.NET and Web Tools 2015.1 (Beta8)
ASP.NET Web Frameworks and Tools 2013 5.2.40314.0
For additional information, visit http://www.asp.net/
Common Azure Tools 1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
JavaScript Language Service 2.0
JavaScript Language Service
JavaScript Project System 2.0
JavaScript Project System
Microsoft Azure Mobile Services Tools 1.4
Microsoft Azure Mobile Services Tools
NuGet Package Manager 3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
PreEmptive Analytics Visualizer 1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.
SQL Server Data Tools 14.0.50616.0
Microsoft SQL Server Data Tools
TypeScript 2.0.0.0
TypeScript tools for Visual Studio
Can you please install Update 3, reinstall TypeScript 2.0, and update the version in your project to 2.0 instead of 1.9. and let us know if you are still seeing the issue.
Apologies, that was a typo in the original post. The above error was with Update 3, TS2.0 and TypeScriptToolsVersion set to both 1.9 and 2.0.
On the machine(s) that are having this issue, MS Edge 20 is installed. This error does not occur on a machine with Edge 25. Could it be an outdated version of Chakra Core that is causing this issue?
Additional note, our workaround is to use npm's [email protected] (with v8) to compile the files that MSBuild cannot.
the error indicate a mismatch between the js file and the tsc.exe file. can you share the version of the tsc.exe file as well?
Both tsc.exe and tsc.js report 2.0.0.
C:\>where tsc
C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.exe
C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.js
I have a repro for this on my machine - not sure if it is universal.
``` ts
declare const Symbol: SymbolConstructor;
interface IterableIterator
Symbol.iterator: IterableIterator
}
interface SymbolConstructor {
iterator: symbol;
}
```
1>------ Rebuild All started: Project: TypeScriptHTMLApp3, Configuration: Debug Any CPU ------
1>Unknown output : Script failed with error : 'JsErrorScriptException (0x30001)'.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
The offending bit of code is the reference to Symbol.iterator.
The workaround is to comment out (in lib.d.ts) all references in index signatures that contain Symbol.
Repro project attached.
The issue reported by @DerFlatulator is different from @NoelAbrahams, I am from the same team of DerFlatulator. The problem is not related to Msbuild or Visual Studio.
On the problem machine: Windows Server 2012 R2 Standard, I was able to reproduce the same issue using tsc.exe command line tool.
// module1.ts
import module2 = require("./module2")
export module module1 {
console.log("Module 1");
}
// module2.ts
export module module2 {
console.log("Module 2");
}
Error:
R:\TeamCity\Debug>"C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.exe" module1.ts
Script failed with error: 'JsErrorScriptException (0x30001)'.
Incorrect function.
Error: Incorrect function.
at ChakraHost.realpath (Unknown script code:1538:70)
at ts.sys.realpath (Unknown script code:36513:62)
at nodeModuleNameResolver (Unknown script code:36261:13)
at resolveModuleName (Unknown script code:36058:17)
at loader_1 (Unknown script code:36630:68)
at loadWithLocalCache (Unknown script code:36576:17)
at resolveModuleNamesWorker (Unknown script code:36631:81)
at processImportedModules (Unknown script code:37357:17)
at findSourceFile (Unknown script code:37281:17)
Strangely, using --module amd does not cause above error, but --module commonjs does.
Problem Machine Details:
@engineforce is R:\ above a RAM drive? It was is on the CI machines that reported this issue, and may be relevant since this looks like a module resolution or file system related problem.
@DerFlatulator: you are correct, R: is a RAM disk (created by ImDisk), and the error only happens on this drive. If I moved module1.ts and module2.ts (from above comment) to D: drive, then no error occurred.
@mhegazy: can this be fixed by TypeScript team? RAM disk has never caused any issue before 2.0, so should 2.0.
We are not aware of any changes that impact RAM disks specifically. what version of Node are you using?
@zhengbli can you take a look
I have just struggled with the same error; I get the same problem when my ASP.NET 4.6.1 project with the "Microsoft.TypeScript.MSBuild.2.0.2-rc" NuGet package builds (MSBUILD) on an Azure Web Site.
I have investigated some, and found that when trying to compile my tsconfig.json project using the "tsc.exe" file inside the "Microsoft.TypeScript.MSBuild.2.0.2-rc" NuGet package folder; tsc.exe always fails. (I tested this using the the Kudu console on the Azure Web Site. The Azure Web Site is probably running on a Windows Server 2012 R2. I even tested stripping down my compilerOptions to a minimum, but it did not help).
>..\packages\Microsoft.TypeScript.MSBuild.2.0.2-rc\tools\tsc\tsc.exe --project tsconfig.json
Script failed with error: 'JsErrorScriptException (0x30001)'.
Unable to get property 'length' of undefined or null reference
TypeError: Unable to get property 'length' of undefined or null reference
at compareStrings (Unknown script code:672:17)
at compareStringsCaseInsensitive (Unknown script code:684:9)
at Array.prototype.sort (native code)
at matchFileNames (Unknown script code:39215:9)
at getFileNames (Unknown script code:39093:13)
at parseJsonConfigFileContent (Unknown script code:39043:9)
at parseConfigFile (Unknown script code:39608:13)
at performCompilation (Unknown script code:39630:21)
at executeCommandLine (Unknown script code:39581:9)
at Global code (Unknown script code:39899:1)_
But when using the exact same "tsc.exe" compiler with the exact same TypeScript project/files and compiler options on my laptop running Windows 10 (Anniversary Update); everything works like charm.
When I compile the same project using NodeJS + the "typescript@rc" npm package, it works perfect in both environments.
I noticed that the folder containing "tsc.exe" inside the TypeScript.MSBuild NuGet package folder also includes "chakracore.dll". I assume that this version of the TypeScript compiler runs the TypeScript compiler in the ChakraCore JS runtime (instead of NodeJS).
*_My preliminary theory is that this could be a problem specific to ChakraCore on Windows 2012 R2 Server. *_
Hope this helps and that the problem will be gone in TS 2.0 RTM
@mhegazy Node.js installed on the affected machines varies from 4.X to 5.X.
@josundt These seem like similar, but slightly different issues. The first rises as an Incorrect Function error, the second is a TypeError. The original issue affects Windows 8 and 10.
I just observed this behavior in VS2015 Update 3 with TS 1.8.36.0
My workaround was to comment out "watch" : true in the compiler options:
{
"compileOnSave": true,
"compilerOptions": {
"noImplicitAny": false,
"removeComments": false,
"target": "ES5"//,
//"watch": true
}
}
@DerFlatulator These may be different bugs, but they both seem to be chakracore specific and the errors occur while building the compiler source files list
Could this be another manifestation of missing DLL problem?
this seems to be the same issue in https://github.com/Microsoft/TypeScript/issues/11110. we have traced this back to Chakra issue on Windows Server 2012, as well as other OS's. we are following up on the issue and should have an update shortly.
Turns out this is a different issue from #11110. So we still do not know what is the cause of this. We are still trying to reproduce this locally. Should have an update soon.
Thanks @vladima for helping me investigating the original reported issue from @DerFlatulator and @engineforce. The issue is from when realPath function (used by node-module-resolution) call "GetFinalPathNameByHandle" in trying to get finalPath in Dos naming. However, due to how RamDisk is created with ImDisk, "GetFinalPathNameByHandle" unsuccessfully find the path in Dos naming. @vladima has suggested a workaround in majority of the cases.
The fix is in our internal repo for Chakra host
The fix should be published in the TypeScript 2.0.6.
TypeScript 2.0.6 should be available now; please give it a try and let us know if there are other issues.
Most helpful comment
The fix should be published in the TypeScript 2.0.6.