我在设计器中出现这个奇怪的错误。
Visual Studio 2013 WPF - 其他视图/窗口工作正常。 这是发生在我有设计时间数据(如果我删除设计时间数据,它工作正常)。WPF Visual Studio Designer中的错误
System.NullReferenceException对象引用未设置为对象的实例 。
在 System.Windows.Controls.GridViewHeaderRowPresenter.OnLayoutUpdated(对象 发件人,EventArgs的)
在 System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
在 System.Windows.ContextLayoutManager.UpdateLayout()
在 System.Windows .UIElement.UpdateLayout()
在 System.Windows.Interop.HwndSource.SetLayoutSize()
在 System.Windows.Interop.HwndSource.set_RootVisualInternal(视觉值)
在System.Windows.Interop.HwndSource.set_RootVisual(视觉值)
at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteUIElement。 <> c__DisplayClass10.b__f()
at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler。 <> c__DisplayClass2a`1.b__29()
在 Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()
在 Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.Invoke(布尔 waitingInExternalCall)
在< Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.InvokeCall(呼叫 调用)
在 Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessQueue(CallQueue 队列)
在 Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.P rocessInboundAsyncQueue(的Int32 同一性)
在 Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessMessage(的Int32 味精,IntPtr的wParam中,IntPtr的lParam的,布尔elevatedQuery,布尔& 处理)
在 Microsoft.Expression.DesignHost。 Isolation.Remoting.STAMarshaler.OnWindowMessage(IntPtr的 HWND,MSG的Int32,IntPtr的wParam中,IntPtr的lParam的,布尔&处理)
在 Microsoft.Expression.DesignHost.Isolation.Remoting.MessageOnlyHwndWrapper.WndProc(IntPtr的 HWND,MSG的Int32,IntPtr的wParam,IntPtr lParam)
at MS.Win32.UnsafeNativeMethod s.DispatchMessage在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame 帧)
在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame帧)
在System.Windows.Threading程序(MSG & MSG)
。 Dispatcher.Run()
在 System.Windows.Application.RunDispatcher(对象忽略)
在 System.Windows.Application.RunInternal(窗口窗口)
在 System.Windows.Application.Run(窗口窗口)
在 Microsoft.Expression.DesignHost.Isolation.DesignerProcess。RunApplication()
at Microsoft.Expression.DesignHost.Isolation.DesignerProcess。 <> c__DisplayClass2.b__0()
在System.Threading.ThreadHelper.ThreadStart_Context(对象状态)
在System.Threading.ExecutionContext.RunInternal(的ExecutionContext 的ExecutionContext,ContextCallback回调,对象的状态,布尔 preserveSyncCtx)
在 系统.Threading.ExecutionContext.Run(的ExecutionContext 的ExecutionContext,ContextCallback回调,对象的状态,布尔 preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(的ExecutionContext 的ExecutionContext,ContextCallback回调,对象状态)
在 SYSTE m.Threading.ThreadHelper.ThreadStart()
错误
视图的代码隐藏功能在设计时无法使用。也许类字段不是通过“默认构造函数”代码路径初始化的。使用设计时检查描述在http://stackoverflow.com/questions/3978264/how-to-check-if-im-in-run-time-or-design-time –
分享你的xaml,看起来像你的罪魁祸首在于它。 –
@ChrisW不是xaml实际上是一个转换器,没有检查为空,是我加了一个空检查它工作正常 - – DermFrench