繁体   English   中英

NullReference异常后收到访问冲突异常(0xc0000005)是否正常

[英]Is it normal to receive access violation exception (0xc0000005) after NullReference exception

我试图解决的一个大问题是确定为什么在我们的托管应用程序之一中,我们不时收到访问冲突异常 (0xc0000005)。 最近,在一个完全不同的应用程序上,我们开始收到 NullReference 异常(现在这是一个已知错误),但随后是 (0xc0000005) 错误。 我想知道这是正常行为还是与我们的“大问题”有关。

访问冲突异常(二)

Faulting application name: Marketform.Ultimates.Client.exe, version: 0.27.0.0, time stamp: 0x52728ad4
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x08cac78a
Faulting process id: 0x10f4
Faulting application start time: 0x01ced7016881cca1
Faulting application path: C:\Users\vxk\AppData\Local\Apps\2.0\WZ2LJT6T.PKK\WEJ4X8PL.17E\mark..tion_5585060aa30c4020_0000.001e_06d3070c7f40068c\Marketform.Ultimates.Client.exe
Faulting module path: unknown
Report Id: b7d08351-42f4-11e3-802a-005056b87be9

NullReference 异常(第一个)

Application: Marketform.Ultimates.Client.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
Stack:
   at Marketform.Ultimates.Module.ViewModels.UltimatePremiumViewModel.CanSave()
   at Microsoft.Practices.Prism.Commands.DelegateCommand+<>c__DisplayClass6.<.ctor>b__3(System.Object)
   at Microsoft.Practices.Prism.Commands.DelegateCommandBase.CanExecute(System.Object)
   at Microsoft.Practices.Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.CanExecute(System.Object)
   at Marketform.Ultimates.Module.DelegateCommandWrapper.CanExecute(System.Object)
   at MS.Internal.Commands.CommandHelpers.CanExecuteCommandSource(System.Windows.Input.ICommandSource)
   at System.Windows.Controls.Primitives.ButtonBase.UpdateCanExecute()
   at System.Windows.Controls.Primitives.ButtonBase.HookCommand(System.Windows.Input.ICommand)
   at System.Windows.Controls.Primitives.ButtonBase.OnCommandChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
   at System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
   at System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
   at System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
   at System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
   at System.Windows.DependencyObject.InvalidateProperty(System.Windows.DependencyProperty)
   at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean)
   at System.Windows.Data.BindingExpression.TransferValue(System.Object, Boolean)
   at System.Windows.Data.BindingExpression.Activate(System.Object)
   at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt)
   at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean)
   at MS.Internal.Data.DataBindEngine+Task.Run(Boolean)
   at MS.Internal.Data.DataBindEngine.Run(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at System.Threading.ExecutionContext.runTryCode(System.Object)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunDispatcher(System.Object)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run(System.Windows.Window)
   at Marketform.Ultimates.Client.App.Main()

是的,这很正常。 Windows 中没有“空引用异常”这样的东西。 这些类型的指针故障由带有通用保护故障陷阱的处理器报告,在操作系统中生成访问冲突异常。 异常代码 0xc0000005。

Windows 通过始终保留从地址 0 开始的底部 64KB 未映射来为进程设置虚拟内存。 特别是为了检测指针错误,它们在编程中很常见。 因此,NULL 指针将始终触发处理器故障。 以及略大于 0 的地址,当程序尝试通过空指针访问对象的字段时生成。

CLR 拦截本机访问冲突异常并查看导致异常的地址。 如果它位于 64KB 地址范围内,则会引发 System.NullReferenceException。 如果不是,则会引发 System.AccessViolationException。

上面的片段是由 Windows 生成的诊断信息,下面是由 CLR 生成的。 最上面的只是显示本机异常代码,Windows 对托管异常一无所知。

对我来说,有一个覆盖图会显示一些导致错误的硬件信息。 一旦我关闭覆盖(华硕 GPUTWEAK II),它就解决了这个问题,确保你没有 3rd 方程序干扰你自己的程序! :)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM