Browse Source

Merge pull request #6849 from workgroupengineering/fixes/Issue_6848

fixes(DevTools): Ambiguous match found Exception
pull/6854/head
Tako 5 years ago
committed by GitHub
parent
commit
e81346e277
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/AvaloniaPropertyViewModel.cs
  2. 4
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/ClrPropertyViewModel.cs
  3. 9
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs
  4. 1
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/PropertyViewModel.cs

4
src/Avalonia.Diagnostics/Diagnostics/ViewModels/AvaloniaPropertyViewModel.cs

@ -19,7 +19,7 @@ namespace Avalonia.Diagnostics.ViewModels
Name = property.IsAttached ? Name = property.IsAttached ?
$"[{property.OwnerType.Name}.{property.Name}]" : $"[{property.OwnerType.Name}.{property.Name}]" :
property.Name; property.Name;
DeclaringType = property.OwnerType;
Update(); Update();
} }
@ -50,6 +50,8 @@ namespace Avalonia.Diagnostics.ViewModels
public override string Group => _group; public override string Group => _group;
public override System.Type? DeclaringType { get; }
// [MemberNotNull(nameof(_type), nameof(_group), nameof(_priority))] // [MemberNotNull(nameof(_type), nameof(_group), nameof(_priority))]
public override void Update() public override void Update()
{ {

4
src/Avalonia.Diagnostics/Diagnostics/ViewModels/ClrPropertyViewModel.cs

@ -24,7 +24,7 @@ namespace Avalonia.Diagnostics.ViewModels
{ {
Name = property.DeclaringType.Name + '.' + property.Name; Name = property.DeclaringType.Name + '.' + property.Name;
} }
DeclaringType = property.DeclaringType;
Update(); Update();
} }
@ -55,6 +55,8 @@ namespace Avalonia.Diagnostics.ViewModels
public override bool? IsAttached => public override bool? IsAttached =>
default; default;
public override System.Type? DeclaringType { get; }
// [MemberNotNull(nameof(_type))] // [MemberNotNull(nameof(_type))]
public override void Update() public override void Update()
{ {

9
src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs

@ -24,7 +24,7 @@ namespace Avalonia.Diagnostics.ViewModels
private bool _showInactiveStyles; private bool _showInactiveStyles;
private string? _styleStatus; private string? _styleStatus;
private object _selectedEntity; private object _selectedEntity;
private readonly Stack<(string Name, object Entry)> _selectedEntitiesStack = new(); private readonly Stack<(string Name,object Entry)> _selectedEntitiesStack = new();
private string _selectedEntityName; private string _selectedEntityName;
private string _selectedEntityType; private string _selectedEntityType;
@ -412,9 +412,12 @@ namespace Avalonia.Diagnostics.ViewModels
} }
else else
{ {
property = _selectedEntity.GetType().GetProperty(selectedProperty.Name)?.GetValue(_selectedEntity); property = selectedEntity.GetType().GetProperties()
.FirstOrDefault(pi => pi.Name == selectedProperty.Name
&& pi.DeclaringType == selectedProperty.DeclaringType
&& pi.PropertyType.Name == selectedProperty.Type)
?.GetValue(selectedEntity);
} }
if (property == null) return; if (property == null) return;
_selectedEntitiesStack.Push((Name:selectedEntityName,Entry:selectedEntity)); _selectedEntitiesStack.Push((Name:selectedEntityName,Entry:selectedEntity));
NavigateToProperty(property, selectedProperty.Name); NavigateToProperty(property, selectedProperty.Name);

1
src/Avalonia.Diagnostics/Diagnostics/ViewModels/PropertyViewModel.cs

@ -15,6 +15,7 @@ namespace Avalonia.Diagnostics.ViewModels
public abstract string Name { get; } public abstract string Name { get; }
public abstract string Group { get; } public abstract string Group { get; }
public abstract string Type { get; } public abstract string Type { get; }
public abstract Type? DeclaringType { get; }
public abstract string Value { get; set; } public abstract string Value { get; set; }
public abstract string Priority { get; } public abstract string Priority { get; }
public abstract bool? IsAttached { get; } public abstract bool? IsAttached { get; }

Loading…
Cancel
Save