Open Perpete opened 2 years ago
Hello,
Running the program twice and at the same time on a single computer does not cause this problem.
On the screenshot, we see the detection of the deletion of the file by the FileSystemWatcher controls of the 2 programs.
Tagging subscribers to this area: @dotnet/area-system-io See info in area-owners.md if you want to be subscribed.
Author: | Perpete |
---|---|
Assignees: | - |
Labels: | `area-System.IO`, `untriaged` |
Milestone: | - |
Hi @Perpete
What do you mean by cloud
? What kind of file share is it? I am asking because we will need to setup something similar to try to reproduce and investigate the issue. Thanks!
This issue has been marked needs-author-action
and may be missing some important information.
Hello,
I use pCloud which is an online storage service. After installing the program, it creates pcloud Drive (P:). The program is installed on the 2 computers with the same settings. The "P" drive is then common to the 2 computers.
For a test, I used a Timer control. In its "Tick" event, I check for file deletion with the "File.Exists(xxxx)" method. The detection of file deletion using the Timer works perfectly on both computers.
The 2 programs see the deletion of the file using the timer.
Here is part of the code with the timer added.
`
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Nom du fichier à surveiller
watcher.Filter = fileTest
'Ajoute l'événement de suppression de fichier
AddHandler watcher.Deleted, AddressOf OnDeleted
watcher.SynchronizingObject = Me
watcher.EnableRaisingEvents = True
'Timer
tmrDelete.Interval = 500
tmrCreatFile.Interval = 500
tmrCreatFile.Start()
End Sub
Private Sub tmrDelete_Tick(sender As Object, e As EventArgs) Handles tmrDelete.Tick
'Gestion de la suppression du fichier
If File.Exists(pathTest & "\" & fileTest) = False Then
tmrDelete.Stop()
txtInfos.Text = txtInfos.Text & Format(Now, "hh:mm:ss ff") & " - detection Of file deletion (Timer)" & vbCrLf
End If
End Sub
Private Sub tmrCreatFile_Tick(sender As Object, e As EventArgs) Handles tmrCreatFile.Tick
'Vérifie la création du fichier
If File.Exists(pathTest & "\" & fileTest) = True AndAlso tmrDelete.Enabled = False Then
tmrDelete.Start()
End If
End Sub
`
.NET version
.NET 6 project in VB with WPF or Winform and visual studio 17.3.6.
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
I don't know.
Issue description
Hello,
An identical program is used on 2 computers. Each program on its computer can create and delete the same file on the cloud. The cloud is seen by the 2 computers. This program uses the FileSystemWatcher control to monitor file erasure from the cloud.
When, I create and delete the file with one of the 2 programs, the FileSystemWatcher control sees the deletion of the file on the program that deleted the file. In contrast, the other program's FileSystemWatcher control does not see the file deletion. Yet it monitors the same directory and the same file. Here is a screenshot of the 2 computers.
File in common cloud directory.
PC1:
PC2:
Here is the program used on each computer in VB.
`Imports System.IO Imports System.Windows Public Class Form1
End Class`
Here is my test program.
WinFormsApp1.zip
Steps to reproduce
Use the test program on 2 different computers with a common folder.