Note that there are some explanatory texts on larger screens.

plurals
  1. POXamlParseException: Attribute in custom control missing, but it's defined!
    primarykey
    data
    text
    <p>I <em>sometimes</em> get the following exception for a custom control of mine:</p> <p><code>XamlParseException occurred</code> <code>Unknown attribute Points in element SectionClickableArea [Line: 10 Position 16]</code></p> <p>The stack trace:</p> <pre><code>{System.Windows.Markup.XamlParseException: Unknown attribute Points on element SectionClickableArea. [Line: 10 Position: 16] at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at SomeMainDialog.InitializeComponent() at SomeMainDialog..ctor()} </code></pre> <p>The element declaration where this happens looks like this (the <strong>event handler</strong> referenced here is defined, of course):</p> <pre><code>&lt;l:SectionClickableArea x:Name="SomeButton" Points="528,350, 508,265, 520,195, 515,190, 517,165, 530,120, 555,75, 570,61, 580,60, 600,66, 615,80, 617,335, 588,395, 550,385, 540,390, 525,393, 520,385" Click="SomeButton_Click"/&gt; </code></pre> <p>This is part of the code of <code>SectionClickableArea</code>:</p> <pre><code>public partial class SectionClickableArea : Button { public static readonly DependencyProperty PointsProperty = DependencyProperty.Register("Points", typeof(PointCollection), typeof(SectionClickableArea), new PropertyMetadata((s, e) =&gt; { SectionClickableArea area = (SectionClickableArea) s; area.areaInfo.Points = (PointCollection) e.NewValue; area.UpdateLabelPosition(); })); public PointCollection Points { get { return (PointCollection) GetValue(PointsProperty); } set { SetValue(PointsProperty, value); } } </code></pre> <p>I use this control for something like a polygon-shaped button. Therefore I'm inheriting from button. I've had similar problems (<code>E_AG_BAD_PROPERTY_VALUE</code> on another <code>DependencyProperty</code> of type string, according to the line and column given, etc) with this control for weeks, but I have absolutely no idea why.</p> <hr> <p>Another exception for the same control occurred this morning for another user (taken from a log and translated from German):</p> <pre><code>Type: System.InvalidCastException Message: The object of type System.Windows.Controls.ContentControl could not be converted to type [...]SectionClickableArea. at SomeOtherMainDialog.InitializeComponent() at SomeOtherMainDialog..ctor() </code></pre> <p>Inner exception:</p> <pre><code>Type: System.Exception Message: An HRESULT E_FAIL error was returned when calling COM component at MS.Internal.XcpImports.CheckHResult(UInt32 hr) at MS.Internal.XcpImports.SetValue(INativeCoreTypeWrapper obj, DependencyProperty property, DependencyObject doh) at MS.Internal.XcpImports.SetValue(INativeCoreTypeWrapper doh, DependencyProperty property, Object obj) at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value) at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle) at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at System.Windows.Controls.Control.set_DefaultStyleKey(Object value) at System.Windows.Controls.ContentControl..ctor() at System.Windows.CoreTypes.GetCoreWrapper(Int32 typeId) at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type, Boolean preserveManagedObjectReference) at MS.Internal.ManagedPeerTable.EnsureManagedPeer(IntPtr unmanagedPointer, Int32 typeIndex, Type type) at MS.Internal.ManagedPeerTable.GetManagedPeer(IntPtr nativeObject) at MS.Internal.FrameworkCallbacks.SetPropertyAttribute(IntPtr nativeTarget, String attrName, String attrValue, String attachedDPOwnerNamespace, String attachedDPOwnerAssembly) </code></pre> <p>Any ideas what's wrong with the control, or what I can do to find the source of these exceptions? As I said, these problem occur only every few dozen times the control is instantiated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload