To check if the commandline works correctly I have accidentally used a file path instead of a
directory which leads to a crash.
Options:
- Index the file
- Exit gracefully with a correct message
Crash output:
โD:\git\code-searcher\CodeSearcher\bin\Debug\net5.0 [NewInternalCmdLineHandleInterface +0 ~5 -0 !]
ฮป .\CodeSearcher.exe --mode index --indexPath "D:\git\code-searcher\CodeSearcherTests\SystemTests\DownloadedTestData" --sourcePath "D:\git\code-searcher\CodeSearcherTests\SystemTests\DownloadedTestData\Fifteen Thousand Useful Phrases\Fifteen Thousand Useful Phrases.txt"
Welcome to CodeSearcher
16:57:56 CodeSearcher Reading Index Overview from C:\Users\lutzb\AppData\Local\code-searcher\IndexOverview.json
16:57:56 CodeSearcher Reading Index Overview from C:\Users\lutzb\AppData\Local\code-searcher\IndexOverview.json
Index of new Source Directory
One or more errors occurred. (One or more errors occurred. (Source Folder dosn't exist!))
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at CodeSearcher.BusinessLogic.CodeSearcherLogic.<>c__DisplayClass6_0.b__1() in D:\git\code-searcher\CodeSearcher.Index\CodeSearcherLogic.cs:line 51
at CodeSearcher.BusinessLogic.CodeSearcherLogic.RunActionWithTimings(String name, Action action) in D:\git\code-searcher\CodeSearcher.Index\CodeSearcherLogic.cs:line 63
at CodeSearcher.BusinessLogic.CodeSearcherLogic.CreateNewIndex(Action startCallback, Action1 fileProccessedCallback, Action
2 finishedCallback) in D:\git\code-searcher\CodeSearcher.Index\CodeSearcherLogic.cs:line 48
at CodeSearcher.Program.CreateIndex(ICodeSearcherLogic logic) in D:\git\code-searcher\CodeSearcher\Program.cs:line 92
at CodeSearcher.Program.Main(String[] args) in D:\git\code-searcher\CodeSearcher\Program.cs:line 42
16:57:56 CodeSearcher
16:57:56 CodeSearcher
16:57:56 CodeSearcher
Process terminated. CodeSearcher: unhandled exception occurs
at System.Environment.FailFast(System.String, System.Exception)
at CodeSearcher.Program+<>c.b__12_0(System.Object, System.UnhandledExceptionEventArgs)
at System.Threading.Tasks.Task.Wait(Int32, System.Threading.CancellationToken)
at System.Threading.Tasks.Task.Wait()
at CodeSearcher.BusinessLogic.CodeSearcherLogic+<>c__DisplayClass6_0.b__1()
at CodeSearcher.BusinessLogic.CodeSearcherLogic.RunActionWithTimings(System.String, System.Action)
at CodeSearcher.BusinessLogic.CodeSearcherLogic.CreateNewIndex(System.Action, System.Action1<System.String>, System.Action
2<Int64,System.TimeSpan>)
at CodeSearcher.Program.CreateIndex(CodeSearcher.BusinessLogic.ICodeSearcherLogic)
at CodeSearcher.Program.Main(System.String[])
System.AggregateException: One or more errors occurred. (One or more errors occurred. (Source Folder dosn't exist!))
---> System.AggregateException: One or more errors occurred. (Source Folder dosn't exist!)
---> System.ArgumentException: Source Folder dosn't exist!
at CodeSearcher.BusinessLogic.Io.FileReader.<>c__DisplayClass3_0.b__0() in D:\git\code-searcher\CodeSearcher.Index\Io\FileReader.cs:line 38
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at CodeSearcher.BusinessLogic.Indexer.DefaultIndexer.b__11_0() in D:\git\code-searcher\CodeSearcher.Index\Indexer\DefaultIndexer.cs:line 96
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at CodeSearcher.BusinessLogic.CodeSearcherLogic.<>c__DisplayClass6_0.b__1() in D:\git\code-searcher\CodeSearcher.Index\CodeSearcherLogic.cs:line 51
at CodeSearcher.BusinessLogic.CodeSearcherLogic.RunActionWithTimings(String name, Action action) in D:\git\code-searcher\CodeSearcher.Index\CodeSearcherLogic.cs:line 63
at CodeSearcher.BusinessLogic.CodeSearcherLogic.CreateNewIndex(Action startCallback, Action1 fileProccessedCallback, Action
2 finishedCallback) in D:\git\code-searcher\CodeSearcher.Index\CodeSearcherLogic.cs:line 48
at CodeSearcher.Program.CreateIndex(ICodeSearcherLogic logic) in D:\git\code-searcher\CodeSearcher\Program.cs:line 92
at CodeSearcher.Program.Main(String[] args) in D:\git\code-searcher\CodeSearcher\Program.cs:line 42
** Correct Usage **
โD:.\CodeSearcher.exe --mode index --indexPath "D:\git\code-searcher\CodeSearcherTests\SystemTests\DownloadedTestData" --sourcePath "D:\git\code-searcher\CodeSearcherTests\SystemTests\DownloadedTestData\Fifteen Thousand Useful Phrases"
Welcome to CodeSearcher
08:26:49 CodeSearcher Reading Index Overview from C:\Users\lutzb\AppData\Local\code-searcher\IndexOverview.json
08:26:49 CodeSearcher Reading Index Overview from C:\Users\lutzb\AppData\Local\code-searcher\IndexOverview.json
Index of new Source Directory
building search index finished!
0 files indexed
action take : 00:00:00.019