Hi, I am new to UiPath and I’m trying to use try catch activity. The exception cannot be caught in catch block but the system exception message box pop out. I have chose the system.exception and ran in nromal mode (which is not debug mode). How to solve this?
The error message:
System.IO.IOException: The process cannot access the file ‘trycatch.xlsx’ because it is being used by another process. 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)
at System.IO.Strategies.OSFileStreamStrategy…ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.Packaging.ZipPackage…ctor(String path, FileMode packageFileMode, FileAccess packageFileAccess, FileShare share)
at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.OpenCore(String path, Boolean readWriteMode)
at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(String path, Boolean isEditable, OpenSettings openSettings)
at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(String path, Boolean isEditable)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook_Load.cs:line 42
at ClosedXML.Excel.XLWorkbook.Load(String file) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook_Load.cs:line 32
at ClosedXML.Excel.XLWorkbook…ctor(String file, XLEventTracking eventTracking) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook.cs:line 717
at ClosedXML.Excel.XLWorkbook…ctor(String file) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook.cs:line 707
at UiPath.Excel.WorkbookFile.InitializeExistingWorbookFile()
at UiPath.Excel.WorkbookFile…ctor(String workbookPath, String password, Boolean createNew)
at UiPath.Excel.Activities.WorkbookActivity1.ConstructWorkbook(String path, String password, Boolean createNew) at UiPath.Excel.Activities.WorkbookActivity
1.BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, Object state)
at System.Activities.AsyncCodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)