What is the cause of LockShareViolation Exception in older versions?
In our older version if the file is already opened we get an exception "Syncfusion.XlsIO.Implementation.Exceptions.LockShareViolationException".You can catch the exception by using
In version v126.96.36.199:
"In our latest version", we use file streams to read and write files and hence "IOException" has been thrown with the message "The process cannot access the file "fileName.xls" because it is being used by another process". There is no specific exception in our library to handle this. You can also open the file as read only when the file is already opened by using OpenReadOnly method as below:
IWorkbook workbook = application.Workbooks.OpenReadOnly(filename);
Dim workbook As IWorkbook = application.Workbooks.OpenReadOnly(filename);
I hope you enjoyed learning about what is the cause of LockShareViolation Exception in older versions in WinForms.
You can refer to our .NET Excel library page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our .NET Excel library example to understand how to create and manipulate data.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedbackportal. We are always happy to assist you!