当我的应用程序从Debug目录运行时,Visual Studio 2010崩溃

时间:2014-04-04 15:53:36

标签: c# visual-studio-2010 crash

只要构建应用程序的解决方案打开,即使应用程序没有在VS2010中运行,也会发生这种情况。

在Visual Studio中触发崩溃的事件是在应用程序正在使用通常看起来像的代码的文件夹中创建文件或目录...

private FileSystemWatcher fileSystemWatcher;

fileSystemWatcher.Changed += new FileSystemEventHandler(this.FileChangedHandler);
fileSystemWatcher.Created += new FileSystemEventHandler(this.FileCreatedHandler);
fileSystemWatcher.Deleted += new FileSystemEventHandler(this.FileDeletedHandler);
fileSystemWatcher.Renamed += new RenamedEventHandler(this.FileRenamedHandler);

然后事件处理程序将适当的节点添加到自定义树视图中。例如,文件创建处理程序是......

    private void FileCreatedHandler(object sender, System.IO.FileSystemEventArgs e)
    {
        if (System.IO.Directory.Exists(e.FullPath) == true)
        {
            //The new file system item is a directory
            DirectoryChecker(e.FullPath);
            findAllDirectories(e.FullPath);
            findAllFiles(e.FullPath);
        }
        else if (System.IO.File.Exists(e.FullPath) == true)
        {
            //The new file system item is a file
            string errorMessage = String.Empty;
            if (createResourceNode(e.FullPath, out errorMessage) == false)
            {
                OutputWindow.addMessage(
                    OutputWindow._OutputType.Error,
                    @"Could not add '" + e.FullPath + @"' to the Resource Manager:" +
                        Environment.NewLine +
                        errorMessage,
                    @"Resource Manager");
            }
        }
    }

现在令我感到困惑的是,这段代码工作正常,应用程序不会崩溃,没有异常,没有问题,它会运行。但是,只要从调试目录执行此代码块,Visual Studio 2010就会崩溃。

任何想法或想法?我正在解决这个问题,但能够在没有崩溃的情况下运行我的环境会很好。

0 个答案:

没有答案