Open squiker opened 12 years ago
The following series of exceptions are on the console output:
A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Controls.WpfPropertyGrid.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll System.Windows.Data Error: 16 : Cannot get 'EditorTemplate' value (type 'DataTemplate') from '(0)' (type 'PropertyContainer'). BindingExpression:Path=(0).EditorTemplate; DataItem='PropertyEditorContentPresenter' (Name=''); target element is 'PropertyEditorContentPresenter' (Name=''); target property is 'ContentTemplate' (type 'DataTemplate') TargetInvocationException:'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Controls.WpfPropertyGrid.ResourceLocator.GetResource(Object key) at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.FindEditorTemplate() at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.get_EditorTemplate() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level) at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)' A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Controls.WpfPropertyGrid.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll System.Windows.Data Error: 16 : Cannot get 'EditorTemplate' value (type 'DataTemplate') from '(0)' (type 'PropertyContainer'). BindingExpression:Path=(0).EditorTemplate; DataItem='PropertyEditorContentPresenter' (Name=''); target element is 'PropertyEditorContentPresenter' (Name=''); target property is 'ContentTemplate' (type 'DataTemplate') TargetInvocationException:'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Controls.WpfPropertyGrid.ResourceLocator.GetResource(Object key) at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.FindEditorTemplate() at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.get_EditorTemplate() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level) at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)' A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Controls.WpfPropertyGrid.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll System.Windows.Data Error: 16 : Cannot get 'EditorTemplate' value (type 'DataTemplate') from '(0)' (type 'PropertyContainer'). BindingExpression:Path=(0).EditorTemplate; DataItem='PropertyEditorContentPresenter' (Name=''); target element is 'PropertyEditorContentPresenter' (Name=''); target property is 'ContentTemplate' (type 'DataTemplate') TargetInvocationException:'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Controls.WpfPropertyGrid.ResourceLocator.GetResource(Object key) at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.FindEditorTemplate() at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.get_EditorTemplate() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level) at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)' A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Controls.WpfPropertyGrid.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll System.Windows.Data Error: 16 : Cannot get 'EditorTemplate' value (type 'DataTemplate') from '(0)' (type 'PropertyContainer'). BindingExpression:Path=(0).EditorTemplate; DataItem='PropertyEditorContentPresenter' (Name=''); target element is 'PropertyEditorContentPresenter' (Name=''); target property is 'ContentTemplate' (type 'DataTemplate') TargetInvocationException:'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Controls.WpfPropertyGrid.ResourceLocator.GetResource(Object key) at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.FindEditorTemplate() at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.get_EditorTemplate() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level) at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)' A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Controls.WpfPropertyGrid.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll System.Windows.Data Error: 16 : Cannot get 'EditorTemplate' value (type 'DataTemplate') from '(0)' (type 'PropertyContainer'). BindingExpression:Path=(0).EditorTemplate; DataItem='PropertyEditorContentPresenter' (Name=''); target element is 'PropertyEditorContentPresenter' (Name=''); target property is 'ContentTemplate' (type 'DataTemplate') TargetInvocationException:'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Controls.WpfPropertyGrid.ResourceLocator.GetResource(Object key) at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.FindEditorTemplate() at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.get_EditorTemplate() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level) at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)' A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Controls.WpfPropertyGrid.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll System.Windows.Data Error: 16 : Cannot get 'EditorTemplate' value (type 'DataTemplate') from '(0)' (type 'PropertyContainer'). BindingExpression:Path=(0).EditorTemplate; DataItem='PropertyEditorContentPresenter' (Name=''); target element is 'PropertyEditorContentPresenter' (Name=''); target property is 'ContentTemplate' (type 'DataTemplate') TargetInvocationException:'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Controls.WpfPropertyGrid.ResourceLocator.GetResource(Object key) at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.FindEditorTemplate() at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.get_EditorTemplate() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level) at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)' A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Controls.WpfPropertyGrid.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll System.Windows.Data Error: 16 : Cannot get 'EditorTemplate' value (type 'DataTemplate') from '(0)' (type 'PropertyContainer'). BindingExpression:Path=(0).EditorTemplate; DataItem='PropertyEditorContentPresenter' (Name=''); target element is 'PropertyEditorContentPresenter' (Name=''); target property is 'ContentTemplate' (type 'DataTemplate') TargetInvocationException:'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Controls.WpfPropertyGrid.ResourceLocator.GetResource(Object key) at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.FindEditorTemplate() at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.get_EditorTemplate() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level) at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)' A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Controls.WpfPropertyGrid.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll System.Windows.Data Error: 16 : Cannot get 'EditorTemplate' value (type 'DataTemplate') from '(0)' (type 'PropertyContainer'). BindingExpression:Path=(0).EditorTemplate; DataItem='PropertyEditorContentPresenter' (Name=''); target element is 'PropertyEditorContentPresenter' (Name=''); target property is 'ContentTemplate' (type 'DataTemplate') TargetInvocationException:'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Controls.WpfPropertyGrid.ResourceLocator.GetResource(Object key) at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.FindEditorTemplate() at System.Windows.Controls.WpfPropertyGrid.GridEntryContainer.get_EditorTemplate() --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) at MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level) at MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)' System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=placeholder'. BindingExpression:Path=AdornedElement.(0).[0].ErrorContent; DataItem=null; target element is 'Image' (Name=''); target property is 'ToolTip' (type 'Object') System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=placeholder'. BindingExpression:Path=AdornedElement.(0).[0].ErrorContent; DataItem=null; target element is 'Image' (Name=''); target property is 'ToolTip' (type 'Object') System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=placeholder'. BindingExpression:Path=AdornedElement.(0).[0].ErrorContent; DataItem=null; target element is 'Image' (Name=''); target property is 'ToolTip' (type 'Object') System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=placeholder'. BindingExpression:Path=AdornedElement.(0).[0].ErrorContent; DataItem=null; target element is 'Image' (Name=''); target property is 'ToolTip' (type 'Object') System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=placeholder'. BindingExpression:Path=AdornedElement.(0).[0].ErrorContent; DataItem=null; target element is 'Image' (Name=''); target property is 'ToolTip' (type 'Object') System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=placeholder'. BindingExpression:Path=AdornedElement.(0).[0].ErrorContent; DataItem=null; target element is 'Image' (Name=''); target property is 'ToolTip' (type 'Object') System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=placeholder'. BindingExpression:Path=AdornedElement.(0).[0].ErrorContent; DataItem=null; target element is 'Image' (Name=''); target property is 'ToolTip' (type 'Object') System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=placeholder'. BindingExpression:Path=AdornedElement.(0).[0].ErrorContent; DataItem=null; target element is 'Image' (Name=''); target property is 'ToolTip' (type 'Object')
Ok al little more digging shows a System.NullReferenceException because the GetResource method in resourcelocator tries to use a null _application reference.. .
If anyone is interested.. It turns out the dynamic resource allocation is a problem in "Hosted" WPF applications (e.g. WPF hosted in winforms).
The solution to this problem is described in this post: http://drwpf.com/blog/2007/10/05/managing-application-resources-when-wpf-is-hosted/
For now adding the following code before "InitializeComponent()" is called will resolve the issue. This was not checked for memory leaks yet..:
if (Application.Current == null) { // create the Application object new Application(); }
Does anyone have a better solution?
Does anyone have a better solution?
I don't know of a better way, am using the same work around in some other winforms apps. Considering how common it is, I don't think a 'better way' exists
Hello,
I would like to use the WpfPropertyGrid inside a plugin based frame application. The plugin is Activex based, with a WPF xaml UI inside a Winforms control. All the code is C# dotnet 3.5.
When I open the UI of the plugin (ActiveX->winforms->WPF) the categories are shown, however the category items only show the text of the base category class "System.Windows.Controls.WpfPropertyGrid.CategoryItem".
Is this a bug or incompatibility with ActiveX ore something? The examples with winforms integration seem to work fine, but when I load the UI inside this plugin structure, the category items are gone....
regards,
Stefan.