Skip to content

Commit

Permalink
chore: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ramezgerges committed Nov 4, 2024
1 parent 90be71c commit 38bab0f
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions src/Uno.UI/UI/Xaml/DependencyObjectStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,6 @@ public static class TraceProvider
/// </summary>
private SpecializedResourceDictionary.ResourceKey? _themeLastUsed;

private const bool _validatePropertyOwner =
#if DEBUG
true;
#else
false;
#endif

#if UNO_HAS_ENHANCED_LIFECYCLE
internal bool IsDisposed => _isDisposed;
#endif
Expand Down Expand Up @@ -797,25 +790,24 @@ private void WritePropertyEventTrace(int eventId, DependencyProperty property, D
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void ValidatePropertyOwner(DependencyProperty property)
{
if (_validatePropertyOwner)
{
var isFrameworkElement = _originalObjectType.Is(typeof(FrameworkElement));
var isMixinFrameworkElement = _originalObjectRef.Target is IFrameworkElement && !isFrameworkElement;
#if DEBUG
var isFrameworkElement = _originalObjectType.Is(typeof(FrameworkElement));
var isMixinFrameworkElement = _originalObjectRef.Target is IFrameworkElement && !isFrameworkElement;

if (
!_originalObjectType.Is(property.OwnerType)
&& !property.IsAttached
if (
!_originalObjectType.Is(property.OwnerType)
&& !property.IsAttached

// Don't fail validation for properties that are located on non-FrameworkElement types
// e.g. ScrollContentPresenter, for which using the Name property should not fail.
&& !isMixinFrameworkElement
)
{
throw new InvalidOperationException(
$"The Dependency Property [{property.Name}] is owned by [{property.OwnerType}] and cannot be used on [{_originalObjectType}]"
);
}
// Don't fail validation for properties that are located on non-FrameworkElement types
// e.g. ScrollContentPresenter, for which using the Name property should not fail.
&& !isMixinFrameworkElement
)
{
throw new InvalidOperationException(
$"The Dependency Property [{property.Name}] is owned by [{property.OwnerType}] and cannot be used on [{_originalObjectType}]"
);
}
#endif
}

public long RegisterPropertyChangedCallback(DependencyProperty property, DependencyPropertyChangedCallback callback)
Expand Down

0 comments on commit 38bab0f

Please sign in to comment.