vladimir-djokic/TSLint

System.ArgumentException on a single ts file with no project/solution

HolgerJeromin opened this issue · 5 comments

Perhaps my VS2015 is configured to noisy but i get this exception on a single ts file:

{
"Version": "W.3.2.2.0",
"Guid": "f845603f-7ebb-4811-8e9f-2cb6ed33be47",
"Type": "System.ArgumentException",
"Time": "07.06.2017 15:09:31",
"Position": "mscorlib--->System.String NormalizePath(System.String, Boolean, Int32, Boolean)",
"Message": "The path is not of a legal form.",
"StackTrace": " at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetDirectoryName(String path)
at TSLint.TsLint.TryGetProjectTsLint(String tsFilename) in D:\Projects\TSLint\TSLint\TsLint.cs:line 81
at TSLint.TsLint.d__5.MoveNext() in D:\Projects\TSLint\TSLint\TsLint.cs:line 36
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TSLint.TsLintTagger.d__12.MoveNext() in D:\Projects\TSLint\TSLint\TsLintTagger.cs:line 104
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TSLint.TsLintQueue.d__3.MoveNext() in D:\Projects\TSLint\TSLint\TsLintQueue.cs:line 24
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TSLint.TsLintTagger.d__10.MoveNext() in D:\Projects\TSLint\TSLint\TsLintTagger.cs:line 87
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__6_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)"
}

Version 0.3.1

In order to better pin-point the issue, please provide me the following information:

  • Node.js version
  • tslint version
  • TypeScript version
  • Your tslint.json configuration(s)
  • Overall project stricture

Example of structure:

MyProject/MySolution.sln
MyProject/MyProject/MyProject.csproj
MyProject/MyProject/node_modules/.bin/tslint.cmd     <-- this can be here
MyProject/tslint.json
MyProject/node_modules/.bin/tslint.cmd               <-- or can be here
MyProject/MyProject/foo/bar.ts                       <-- location of problematic .ts

Also, do you have any special characters in your solution/project structure?

This is a plain text file in visual studio with no solution loaded. So start VS and drag one TS file into the editor.

My normal projects have an own .node_modules folder but we have no project and no solution in this case.

Node.js version v5.2.0
tslint version (not installed globally)
TypeScript version v2.3
Your tslint.json configuration(s) (no project, no solution, no tslint.json)
Overall project strcture (no project, no solution)

I am totally fine with "no linting" in this case, but an exception dialog on every save is a bit annoying. :-)

I can confirm the issue with this kind of scenario. It will be resolved with the next release (will let you know here).

I've resolved the issue and uploaded new version (0.4). I also added ability to lint dragged and explicitly opened .ts files, if the tslint.cmd and tslint.json are somewhere in the path of the file.

For example, if you drag or explicitly open a file:
MyProject/one/two/three/four/foo/bar/file.ts

And have tslint.cmd and tslint.json somewhere in the path of the file, for example:

MyProject/one/two/three/node_modules/.bin/tslint.cmd
MyProject/one/two/three/tslint.json

Linting should work, even without having solution/project associated with that file.

Please download the new version and test it for you scenario. If you have any other issues, do not hesitate to submit them :)

Work here. Thanks a lot!