Articles in this section
Category / Section

What is the cause of LockShareViolation Exception in older versions?

1 min read

Older version:

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

Syncfusion.XlsIO.Implementation.Exceptions.LockShareViolationException class

In version v6.3.0.30:

"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.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

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 forumsDirect-Trac, or  feedbackportal. We are always happy to assist you!

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment