Filesystemwatcher不会在Windows7的C#中引发重命名事件处理程序 [英] Filesystemwatcher does not raise rename event handler in C# on Windows7

查看:134
本文介绍了Filesystemwatcher不会在Windows7的C#中引发重命名事件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7上使用C#3.5。我们已经用FileSystemWatcher实现了一个程序。在这里,重命名事件不会被提出。但是它正在几个系统上工作。

I am using C# 3.5 on Windows 7. We have implemented a program with a FileSystemWatcher. Here, rename event is not raised. But it is working on a few systems.

可能导致这种情况?

推荐答案

您的代码中可能会有一个时间窗口,以便在所有系统上都不会正确捕获所有的文件系统事件。你可以发布吗?

There may be a timing window in your code such that not all filesystem events are properly captured on all your systems. Can you post it?

这是一个基本的Win32 API ReadDirectoryChangesW的功能,因此FileSystemWatcher在负载较重的情况下可能会错过。 MSDN文档中有缓解建议。

It is a 'feature' of the underlying Win32 API ReadDirectoryChangesW and hence FileSystemWatcher that under heavy load, events can get missed. There are mitigation suggestions in the MSDN docs.

这篇关于Filesystemwatcher不会在Windows7的C#中引发重命名事件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆