diff --git a/samples/BindingTest/App.xaml.cs b/samples/BindingTest/App.xaml.cs
index 80fcaf8433..ff0fe8e65a 100644
--- a/samples/BindingTest/App.xaml.cs
+++ b/samples/BindingTest/App.xaml.cs
@@ -2,6 +2,7 @@
using Perspex;
using Perspex.Controls;
using Perspex.Diagnostics;
+using Perspex.Logging.Serilog;
using Perspex.Markup.Xaml;
using Serilog;
using Serilog.Filters;
@@ -15,13 +16,7 @@ namespace BindingTest
RegisterServices();
InitializeSubsystems((int)Environment.OSVersion.Platform);
InitializeComponent();
-
- Log.Logger = new LoggerConfiguration()
- .Filter.ByIncludingOnly(Matching.WithProperty("Area", "Property"))
- .Filter.ByIncludingOnly(Matching.WithProperty("Property", "Text"))
- .MinimumLevel.Verbose()
- .WriteTo.Trace(outputTemplate: "[{Id:X8}] [{SourceContext}] {Message}")
- .CreateLogger();
+ InitializeLogging();
}
public static void AttachDevTools(Window window)
@@ -41,5 +36,15 @@ namespace BindingTest
{
PerspexXamlLoader.Load(this);
}
+
+ private void InitializeLogging()
+ {
+#if DEBUG
+ SerilogLogger.Initialize(new LoggerConfiguration()
+ .MinimumLevel.Warning()
+ .WriteTo.Trace(outputTemplate: "{Area}: {Message}")
+ .CreateLogger());
+#endif
+ }
}
}
diff --git a/samples/BindingTest/BindingTest.csproj b/samples/BindingTest/BindingTest.csproj
index 406c5b1cfb..91d9f590da 100644
--- a/samples/BindingTest/BindingTest.csproj
+++ b/samples/BindingTest/BindingTest.csproj
@@ -139,6 +139,10 @@
{42472427-4774-4c81-8aff-9f27b8e31721}
Perspex.Layout
+
+ {b61b66a3-b82d-4875-8001-89d3394fe0c9}
+ Perspex.Logging.Serilog
+
{6417b24e-49c2-4985-8db2-3ab9d898ec91}
Perspex.ReactiveUI
diff --git a/src/Markup/Perspex.Markup/Data/Plugins/InpcPropertyAccessorPlugin.cs b/src/Markup/Perspex.Markup/Data/Plugins/InpcPropertyAccessorPlugin.cs
index 3a71859b4c..ac38ee74f9 100644
--- a/src/Markup/Perspex.Markup/Data/Plugins/InpcPropertyAccessorPlugin.cs
+++ b/src/Markup/Perspex.Markup/Data/Plugins/InpcPropertyAccessorPlugin.cs
@@ -7,6 +7,7 @@ using System.Linq;
using System.Reactive.Linq;
using System.Reflection;
using Perspex.Data;
+using Perspex.Logging;
using Perspex.Utilities;
namespace Perspex.Markup.Data.Plugins
@@ -57,6 +58,13 @@ namespace Perspex.Markup.Data.Plugins
}
else
{
+ Logger.Error(
+ LogArea.Binding,
+ this,
+ "Could not find CLR property {Property} on {Source}",
+ propertyName,
+ instance);
+
return null;
}
}
@@ -88,6 +96,16 @@ namespace Perspex.Markup.Data.Plugins
nameof(inpc.PropertyChanged),
this);
}
+ else
+ {
+ Logger.Warning(
+ LogArea.Binding,
+ this,
+ "Bound to property {Property} on {Source} which does not implement INotifyPropertyChanged",
+ property.Name,
+ reference.Target,
+ reference.Target.GetType());
+ }
}
public Type PropertyType => _property.PropertyType;
diff --git a/src/Markup/Perspex.Markup/Data/Plugins/PerspexPropertyAccessorPlugin.cs b/src/Markup/Perspex.Markup/Data/Plugins/PerspexPropertyAccessorPlugin.cs
index 411fcc1555..4d2f6c5cb0 100644
--- a/src/Markup/Perspex.Markup/Data/Plugins/PerspexPropertyAccessorPlugin.cs
+++ b/src/Markup/Perspex.Markup/Data/Plugins/PerspexPropertyAccessorPlugin.cs
@@ -4,6 +4,7 @@
using System;
using System.Reactive.Linq;
using Perspex.Data;
+using Perspex.Logging;
namespace Perspex.Markup.Data.Plugins
{
@@ -53,6 +54,12 @@ namespace Perspex.Markup.Data.Plugins
}
else
{
+ Logger.Error(
+ LogArea.Binding,
+ this,
+ "Could not find PerspexProperty {Property} on {Source}",
+ propertyName,
+ instance);
return null;
}
}
diff --git a/src/Markup/Perspex.Markup/DefaultValueConverter.cs b/src/Markup/Perspex.Markup/DefaultValueConverter.cs
index 23bb0f774c..9f535081a7 100644
--- a/src/Markup/Perspex.Markup/DefaultValueConverter.cs
+++ b/src/Markup/Perspex.Markup/DefaultValueConverter.cs
@@ -5,6 +5,7 @@ using System;
using System.Globalization;
using System.Linq;
using System.Reflection;
+using Perspex.Logging;
using Perspex.Utilities;
namespace Perspex.Markup
@@ -38,10 +39,18 @@ namespace Perspex.Markup
{
return result;
}
- else
+
+ if (value != null)
{
- return PerspexProperty.UnsetValue;
+ Logger.Error(
+ LogArea.Binding,
+ this,
+ "Could not convert {Value} to {Type}",
+ value,
+ targetType);
}
+
+ return PerspexProperty.UnsetValue;
}
///
diff --git a/src/Perspex.Base/Logging/LogArea.cs b/src/Perspex.Base/Logging/LogArea.cs
index cf9ac4b331..c77966be4b 100644
--- a/src/Perspex.Base/Logging/LogArea.cs
+++ b/src/Perspex.Base/Logging/LogArea.cs
@@ -9,10 +9,15 @@ namespace Perspex.Logging
public static class LogArea
{
///
- /// The log event comes from the property and binding system.
+ /// The log event comes from the property system.
///
public const string Property = "Property";
+ ///
+ /// The log event comes from the binding system.
+ ///
+ public const string Binding = "Binding";
+
///
/// The log event comes from the visual system.
///
diff --git a/src/Perspex.Base/Utilities/WeakSubscriptionManager.cs b/src/Perspex.Base/Utilities/WeakSubscriptionManager.cs
index d79600a038..cb4cc061f1 100644
--- a/src/Perspex.Base/Utilities/WeakSubscriptionManager.cs
+++ b/src/Perspex.Base/Utilities/WeakSubscriptionManager.cs
@@ -114,7 +114,7 @@ namespace Perspex.Utilities
void Destroy()
{
- _info.RemoveEventHandler(_target, _delegate);
+ _info.RemoveMethod.Invoke(_target, new[] { _delegate });
_sdic.Remove(_eventName);
}
diff --git a/src/Perspex.SceneGraph/Media/DrawingContext.cs b/src/Perspex.SceneGraph/Media/DrawingContext.cs
index 41a599858e..72f4bcbace 100644
--- a/src/Perspex.SceneGraph/Media/DrawingContext.cs
+++ b/src/Perspex.SceneGraph/Media/DrawingContext.cs
@@ -178,7 +178,7 @@ namespace Perspex.Media
/// The opacity.
/// A disposable used to undo the opacity.
public PushedState PushOpacity(double opacity)
- //TODO: Elimintate platform-specific push opacity call
+ //TODO: Eliminate platform-specific push opacity call
{
_impl.PushOpacity(opacity);
return new PushedState(this, PushedState.PushedStateType.Opacity);