我想弄清楚为什么我收到以下错误:
System.AccessViolationException was unhandled
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
我正在编写一个WPF程序,C#4.0。有点难以解释,所以希望这是有道理的。我有一个自定义数据网格类(一切正常),以及一个在数据网格更改时触发的事件处理程序。这一切都很好。在事件处理程序中,我添加了一个传递Action委托的调度程序,它更新存储在MainWindow类中存储的另一个类的实例中的变量(希望这仍然有意义)。当我去访问已更新的变量时,我得到上面的错误。
也许另一种方式来处理正在发生的事情:
Have some class X, that contains some variable xx.
MainWindow contains instance of class X
CustomGridClass triggers event handler.
Event handler passes delegate to MainWindow: Action{Update(X.xx)};
After this completes, try to access X.xx, which causes error.
由于
答案 0 :(得分:0)
有点看起来很奇怪但我曾经在我的xaml标记中出现错误时在Visual Studio 2008中出现此错误。只是错误的地方或未公开的报价。设计师可能不会报告错误,但它就在那里。