English 中文(简体)
错误: C # 文件夹浏览器对话框, 试图读取或写入保护内存
原标题:Error: C# Folder Browser Dialog, Attempted to read or write protected memory

我正在2008年视觉工作室开发一个 C# 应用程序, 该程序使用文件夹浏览器对话框和打印对话框。 最近, 当这两个对话框的 < code> ShowDialog () 方法被调用时, 程序会遇到错误 。

错误写道:

试图读写或写入受保护的内存。 这往往表明其他内存已经损坏 。

奇怪的是, 此错误仅针对此工程 。 当我在一个新的 C# 工程中使用文件夹浏览器对话框时, 此错误非常有效 。 此外, 此错误最近开始发生于上述工程中 。 早些时候, 此错误曾非常有效 。 另外, 在调试模式下运行 IDE 程序时, 此错误不会发生 。

在调试选项中, Stack 溢出去检查“ 在模块负荷上压缩 JIT 优化 ” 。 在其他一些问题中,也有一条建议。 我试过了,但是这解决不了我的问题。

有人能帮我解决这个问题吗?

问题回答

如果看不到任何代码, 很难说是什么 。 我曾经看到过这个问题, 在创建的线条上存取 UU 的 UU 界面时遇到过这个问题 。 要避免它, 如果您重新从线索中干扰 UUU 控制, 您可以创建如下函数 :

public static void ExecuteAction(Control myControl, Action myAction) 
{
    if (myControl.InvokeRequired) { myControl.Invoke(myAction); }
    else { myAction(); }
}

然后,不管你想从哪条线索调用它 与控件和你想做的动作(比如,改变它的颜色或什么) 。

I haven t seen the issue with Dialogs specifically since I haven t done anything with them in a long time, but since it s a UI issue, and it s the same error message I ve seen before, I d give it a shot.
You might also check the value of Control.CheckForIllegalCrossThreadCalls. http://msdn.microsoft.com/en-us/library/system.windows.forms.control.checkforillegalcrossthreadcalls.aspx





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签