I am trying to use try-catch block for doing “FileNotFoundException”
I have given a wrong path inside read text file which is in the try block.
inside catch block i have System.IO.FileNotFoundException and log message
Now when I execute, its directly showing could not file path but not the log message.
Error
Read Text File: One or more errors occurred. (Could not find file ‘C:\Users\91987\Documents\UiPath\BlankProcess3\trcatch.txt’.) (Could not find file ‘C:\Users\91987\Documents\UiPath\BlankProcess3\trcatch.txt’.) (Could not find file ‘C:\Users\91987\Documents\UiPath\BlankProcess3\trcatch.txt’.)
RemoteException wrapping System.AggregateException: One or more errors occurred. (Could not find file ‘C:\Users\91987\Documents\UiPath\BlankProcess3\trcatch.txt’.) (Could not find file ‘C:\Users\91987\Documents\UiPath\BlankProcess3\trcatch.txt’.) (Could not find file ‘C:\Users\91987\Documents\UiPath\BlankProcess3\trcatch.txt’.) —> RemoteException wrapping System.IO.FileNotFoundException: Could not find file ‘C:\Users\91987\Documents\UiPath\BlankProcess3\trcatch.txt’.
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath,
FileMode mode,
FileAccess access,
FileShare share,
FileOptions options)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath,
FileMode mode,
FileAccess access,
FileShare share,
FileOptions options,
Int64 preallocationSize,
Nullable1 unixCreateMode) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path,
FileMode mode,
FileAccess access,
FileShare share,
FileOptions options,
Int64 preallocationSize,
Nullable1 unixCreateMode) at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize) at System.IO.File.ReadAllText(String path, Encoding encoding) at UiPath.Core.Activities.ReadTextFile.<>c__DisplayClass19_0.<ExecuteAsync>b__0() at UiPath.Core.Activities.Retry.Do[ResultType](Func1 action,
Int32 timeoutMS,
Int32 retryCount)
— End of inner exception stack trace —
at UiPath.Core.Activities.TaskAsyncCodeActivityWithResult1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity1.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor,
BookmarkManager bookmarkManager)




