试图读取或写入受保护的内存。当我打电话的OpenFileDialog的ShowDialog方法 [英] Attempted to read or write protected memory. When I call showDialog method of openfileDialog

查看:438
本文介绍了试图读取或写入受保护的内存。当我打电话的OpenFileDialog的ShowDialog方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近在我的项目,当我打电话的ShowDialog 打开文件对话框的方法,我得到这个错误:

recently in my project when I call ShowDialog method of OpenFileDialog I get this error:

尝试读取或写入受保护的内存。这通常是指示其他内存已损坏。

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

我一直在寻找所有网站之前,但现在我的问题没有解决。
我也安装了Microsoft补丁,但因为我的项目是在.n​​et 3.5,这是没有用的。

I have been searching all over the web before now but my problem did not solve. Also I installed microsoft patch, but because my project is in .Net 3.5, it was not useful.

代码示例:

OpenFileDialog OFD = new OpenFileDialog(); 
OFD.ShowDialog();



感谢您的帮助。

Thanks for any help.

推荐答案

打开文件对话框加载大量的非托管代码到你的过程。所有已安装在机器上的外壳扩展。其中一人是不是你的程序的环境非常满意,或与您的过程足够的混乱,使之和好如初。

OpenFileDialog loads a large amount of unmanaged code into your process. All of the shell extensions that you have installed on your machine. One of them isn't very happy about your process environment, or messes with your process enough to make it crash and burn.

您需要找到外壳扩展导致此。开始与项目+属性,调试选项卡,勾选启用非托管代码调试选项。现在你会看到,得到的输出窗口中加载的DLL列表。赔率是合理的,你看你得到的异常前的最后一个是麻烦制造者。虽然你仍然必须进行反向工程的DLL名称外壳扩展名。

You'll need to find the shell extension that causes this. Start with Project + Properties, Debug tab, tick the "Enable unmanaged code debugging" option. You'll now see the list of DLLs that get loaded in the Output window. Odds are reasonable that the last one you see before you get the exception is the trouble-maker. Although you'll still have to reverse-engineer the DLL name to the shell extension name.

另一种方法是刀耕火种。使用Sysinternals的自动运行程序。点击浏览器选项卡,禁用任何不是由微软提出。问这个在superuser.com

The other approach is slash and burn. Use SysInternals' AutoRuns utility. Click the Explorer tab and disable anything that wasn't made by Microsoft. Ask more questions about this at superuser.com

这篇关于试图读取或写入受保护的内存。当我打电话的OpenFileDialog的ShowDialog方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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