This is a migrated thread and some comments may be shown as answers.

file sharing violation

20 Answers 280 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
K
Top achievements
Rank 1
K asked on 29 Nov 2010, 03:32 PM
Hi,

I'm getting a sharing violation exception when using RadAsyncUpload (version 2010.3.1117.35)  to upload an Excel file which is also open in another window. 

Is there a way to trap or prevent the error?    The exception appears to occur before the client-side events fire, so neither the
OnClientFileUploadFailed   or  OnClientValidationFailed execute.

Thanks in advance for your help,

20 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 02 Dec 2010, 07:14 PM
Hi K,

I tried uploading a file open in Excel without any issues.

What do you mean by open in another window? Can you provide me with a step-by-step use-case, which I can test on my side to reproduce the exception?

Best wishes,
Simon
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
K
Top achievements
Rank 1
answered on 02 Dec 2010, 08:15 PM

Hi Simon,

1. Open a spreadsheet in Excel.  (I'm using Excel 2007)
2. Use the AsyncUpload control to attempt to upload the file while it is still open in Excel.
3. An error occurs and the file isn't loaded into the RadUploadTemp folder.

That's what I mean by "open in another window".   One window is Excel and the other is the browser.

I'm able to upload to file without problem if I close the file in Excel.   The following two errors are recorded in the FF error console, although the problem exists in IE as well.

Let me know if you need more info.

Thanks,

Error: uncaught exception: Error while uploading, [IO.IO_SharingViolation_File]
Arguments: 2007 format.xlsx
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50917.0&File=mscorlib.dll&Key=IO.IO_SharingViolation_File

Error: Unhandled Error in Silverlight Application [IO.IO_SharingViolation_File]
Arguments: 2007 format.xlsx
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50917.0&File=mscorlib.dll&Key=IO.IO_SharingViolation_File ;  at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
   at System.IO.FileInfo.OpenRead()
   at UploadPrototype.UploadContext.GetCurrentChunk()
   at UploadPrototype.MainPage.ProcessRequest(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass9.<InvokeGetRequestStreamCallback>b__7(Object state2)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Line: 0
0
Simon
Telerik team
answered on 03 Dec 2010, 06:10 PM
Hi K,

Thank you for the additional info.

It seems that Excel 2007 locks the file for reading when after opening it. I first tested in Excel 2010, which did not lock the file, so I could not see the error.

I logged this issue and updated your Telerik points for finding it and reporting it to us. We will address the bug in the upcoming weeks.

All the best,
Simon
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Sanjivani
Top achievements
Rank 1
answered on 07 Jan 2011, 02:23 PM
I am having the same problem, any updated on this?
0
Simon
Telerik team
answered on 07 Jan 2011, 04:49 PM
Hello Sanjivani,

The issue is still in the log for fixing. Since RadAsyncUpload is currently undergoing a series of other more important fixes this one would be probably be addressed at a later time.

Regards,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Steve
Top achievements
Rank 1
answered on 03 Aug 2011, 09:42 PM
Hi,

Has this issue been fixed?  Is it fixed for any file that you might try to upload that is open (i.e. Excel 2010, 2007, 2003)?  Which version was this addressed in, if so- I may have to upgrade to it.  Finally, is there a way to trap this situation in an error, and report a friendly message to the user?

Thanks,

Steve
0
David
Top achievements
Rank 1
answered on 04 Aug 2011, 07:00 PM
I too would like to know this... it's an irritating bug indeed. 
0
Peter Filipov
Telerik team
answered on 08 Aug 2011, 04:06 PM
Hi David,

After further investigation, it seems that Silverlight cannot access files that are opened by another process. With the latest version of our controls- Q2 2011 it is possible to upload already opened files with all other modules: IFrame/Flash/FileApi.

Please use the javascript code below to disable the Silverlight module:

Telerik.Web.UI.RadAsyncUpload.Modules.Silverlight.isAvailable = function() { return false; };

Regarding Steve's last post on 04-Aug-2011. Please use OnClinetFileUploadFailed event.

Regards,
Peter Filipov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Steve
Top achievements
Rank 1
answered on 08 Aug 2011, 05:55 PM
Hi Peter,

I'm not sure what each of the suggestions that you made does:

Does the silverlight script diable Silverlight?  or the functioning of the AsynchUpload control's use of Silverlight?  If you do this, does that diable filters for the file types (I am only allowing .xlsx or .xls in my application- and I do not wish to give that up)?  What do the other API's do compared to Silverlight?

OnClientFileUploadFailed- the link does not provide any details regarding what that does, or how it is implemented.  Currently, I am providing a warning on the page if the UploadedFiles collection.Count()=0.  This can be true both if the file could not be uploaded for any reason, such as having the file opened, or because the user has yet to select a file to upload.  My hope was to distinguish between the two scenarios.

I am using QTR 2 2011, so the latest version still has the issue.  Will it be addressed, or is this the best we are going to get?

Thanks

0
Peter Filipov
Telerik team
answered on 11 Aug 2011, 02:31 PM
Hello Steve,

Using the sample code in my last post disable the functioning of the RadAsynchUpload to use Silverlight. Silverlight will be available for all other applications.
Here is a list of the modules used in different browsers by priority:
Firefox - Silverlight-FileApi-Flash
IE - Silverlight-Flash-IFrame
With FIleApi and IFrame module it is not possible to use the dialog filter. Nevertheless the validation if the correct file type is selected is working fine.

Regarding OnClientFileUploadedFail event handling, please consult with the following sample code:
<script type="text/javascript">
 
    function FileUploadFailed(sender, args) {
        alert(agrs.get_message());
 
    }
 
</script>
<telerik:RadAsyncUpload runat="server" ID="AsyncUpload1"
    OnClientFileUploadFailed="FileUploadFailed"
     >
</telerik:RadAsyncUpload>

I hope this information helps. I will be glad to assist you further.

Kind regards,
Peter Filipov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Raji
Top achievements
Rank 1
answered on 03 Jan 2013, 12:50 AM
I added the below line to the code

Telerik.Web.UI.RadAsyncUpload.Modules.Silverlight.isAvailable =

function() { return false; };

 


I get an javascript error "Exception thrown and not caught" when trying to upload a file opened on the client machine.

How do I get rid of this error and still be able to upload the file.

Thanks,
Raji
0
Plamen
Telerik team
answered on 07 Jan 2013, 02:48 PM
Hello Raji,

 
I have tried to reproduce the same behavior but to no avail. I am attaching my test project. Please review it and let me know if you still can observe the same behavior at your side with it. 

If yes please try to set the DisablePlugins property to True and let us know what was the result as well.

Regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Raji
Top achievements
Rank 1
answered on 07 Jan 2013, 05:53 PM
Hi Plamen,

I tried to execute your same app and when I try to browse a file and upload I get the login prompt. If I set the value to true, the propt goes away. I am using .Net 2.0 framework and VS2005.

Telerik.Web.UI.RadAsyncUpload.Modules.Silverlight.isAvailable =

function () { return true; }

I would like the user to upload a file that is opened on users machine. With the above value set to true. I get the javascript error "Exception thrown and not caught".

Thanks,
Raji

 

0
Plamen
Telerik team
answered on 10 Jan 2013, 11:09 AM
Hello,

 
Have you tried to remove the javascript you posted above and set the DisablePlugins="True" property of RadAsyncUpload?

All the best,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jeff
Top achievements
Rank 1
answered on 20 Mar 2013, 07:33 PM
I suspect you were able to resolve your issue but I figured I would add what I did to work around the javascript error:

I utilized the OnClientFileUploadFailed event. It will display to the user that the file is in use and remove the selected file from RadAsyncUpload and allows the user to select the file again without having to remove it first.

function OnClientFileUploadFailed(sender, args) {
            var label = document.getElementById('<%=lblresult2.ClientID %>')
            var upload = $find("<%= rdupload2.ClientID %>");
            var errormsg = args.get_message();
            var displaymsg = new String();
            sender.deleteFileInputAt(0);
            if (errormsg.search("[IO.IO_SharingViolation_File]") != -1) {
                displaymsg = errormsg.substr(42, 10) + " is currently in use. Please close the file and try again.";
            }
            else {
                displaymsg = "The file you selected is currently in use. Please close the file and try again.";
            }
            alert(displaymsg);
            args.set_handled(true);
        }
  
  
<telerik:RadAsyncUpload ID="rdupload2" runat="server" UploadedFilesRendering="BelowFileInput" OnClientFilesUploaded="filesuploaded2" Width="260px"
                                AllowedFileExtensions=".xls,.xlsx,.txt,.raw" TemporaryFileExpiration="00:01:00" TemporaryFolder="~/tempdocs" MaxFileInputsCount="1"
                                OnClientFileUploadRemoved="filesremoved2" Font-Size="Medium" Skin="Office2010Blue" OnClientFileSelected="OnClientFileSelected"
                                OnClientFileUploadFailed="OnClientFileUploadFailed" >
                        </telerik:RadAsyncUpload>


* The errormsg.substr gets the selected filename to display in the alert if the error is a IO.IO_SharingViolation_File.

Hope this is useful to someone.
0
Plamen
Telerik team
answered on 21 Mar 2013, 10:00 AM
Hello Jeff,

 
Thank you for sharing your solution with the community.

All the best,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Skandar
Top achievements
Rank 1
answered on 20 Jun 2013, 05:17 AM
Dear Mr Plamen,

When we will have a fix on the component level about this issue?.

I can't use disable plugins because I will disable the rich features of the component and we are using IE9 and IE10 with the silverlight backend.

Mr.Jeff comment shows a work around but I think we need something more robust.

I will really appreciate if you can give an estimation about this issue that have long time affected the RadAsyncUpload component.

Best Regards,
Skandar.
0
Plamen
Telerik team
answered on 20 Jun 2013, 08:08 AM
Hello Skandar,

 
We have been inspecting the issue and it seems that the problem is rather a limitation of the Silverlight module itself than with RadAsyncUpload. The is why unfortunately at the moment we can not commit on ETA for fixing it.

Hope this will explain the issue.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Skandar
Top achievements
Rank 1
answered on 02 Jul 2013, 09:49 AM
Hello Mr.Plamen,

Thank you for your support, I guess we will go with Mr.Jeff workaround is the only option and in the near future drop support for Silverlight.

Regards,
Skandar.
0
Randy Hompesch
Top achievements
Rank 1
answered on 05 Aug 2014, 06:51 PM
Brilliant! Absolutely perfect!
Thanks... Ed
Tags
AsyncUpload
Asked by
K
Top achievements
Rank 1
Answers by
Simon
Telerik team
K
Top achievements
Rank 1
Sanjivani
Top achievements
Rank 1
Steve
Top achievements
Rank 1
David
Top achievements
Rank 1
Peter Filipov
Telerik team
Raji
Top achievements
Rank 1
Plamen
Telerik team
Jeff
Top achievements
Rank 1
Skandar
Top achievements
Rank 1
Randy Hompesch
Top achievements
Rank 1
Share this question
or