【发布时间】:2018-02-27 11:20:41
【问题描述】:
有时(尽管很少)我会从以下代码行中得到 System.AccessViolationException
var background = deviceWatcher.GetBackgroundTrigger(new List<DeviceWatcherEventKind> { DeviceWatcherEventKind.Add, DeviceWatcherEventKind.Remove, DeviceWatcherEventKind.Update });
System.AccessViolationException
HResult=0x80004003
Message=试图读取或写入受保护的内存。这通常表明其他内存已损坏。
我应该做些什么来防止这个异常?
【问题讨论】: