Hi,
We have found a strange issue that I have created a REPL to reproduce: https://blazorrepl.telerik.com/cnupFJbS23F6HHJ006
1. Select a .doc file
2. Select a second file
3. Click the "Copy Memory Stream" Button
the method stops at CopyToAsync for the .doc file
It seems to work fine if the files are selected together or if different file types are used
I have been testing with the attached .doc and a blank .txt file
Hello,
After reviewing the details, we have decided to update the bug report status to "Declined." I've tried to cast the `FileInfoStream` to `System.IO.Stream` and the problem is still reproducible, therefore it seems the issue is related to the `Stream` class API and the `CopyToAsync` method.
Regards,
Yanislav
Progress Telerik
Hi Yanislav,
Thank you for getting back to me
I will implement the suggested fix
Hello Stewart,
Thank you for providing an example! It was really helpful.
I successfully replicated the issue you mentioned. It appears that when calling the await `Stream.CopyToAsync` method, the program hangs. While I'm not an expert in streams, it seems like the problem could be related to a deadlock. It's worth noting that the `CopyToAsync` method is inherited from the `System.IO.Stream` class, so it is not a method that we've implemented ourselves. Therefore, to gain further insights, I conducted research and found that similar issues have been reported in various scenarios not related to Telerik UI.
Based on my findings, one potential solution that seems to work is to use the `Task.Run()` method. By executing the `CopyToAsync` method on a separate thread, we can avoid the deadlock issue, and the program runs without hanging.
Task.Run(() => { file.Stream.CopyToAsync(ms); }).Wait();
Here is a modified example that demonstrates this approach: https://blazorrepl.telerik.com/GHEpGcvY091FijBg32
I hope this explanation clarifies the situation and offers a viable solution to the problem you encountered. In the meantime, I'll discuss the issue further with our development team to confirm if the issue is related to the FileInfoStream, then update the thread status.
Regards,
Yanislav
Progress Telerik