WpfBindingErrors 1.2.0

dotnet add package WpfBindingErrors --version 1.2.0
                    
NuGet\Install-Package WpfBindingErrors -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WpfBindingErrors" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WpfBindingErrors" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="WpfBindingErrors" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WpfBindingErrors --version 1.2.0
                    
#r "nuget: WpfBindingErrors, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WpfBindingErrors@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WpfBindingErrors&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=WpfBindingErrors&version=1.2.0
                    
Install as a Cake Tool

Turn WPF binding errors into exceptions

This project is a reusable assembly that converts WPF binding errors into exceptions.

Feel free to include it in your own project.

Content

  1. Class BindingException is the typed exception thrown when a binding error occurs
  2. Static class BindingExceptionThrower is the one that throws BindingException.
  3. Class BindingErrorListener adds a listener to PresentationTraceSources.DataBindingSource. It raises the event ErrorCatched whenever a binding error occurs.
  4. Class ObservableTraceListener is internal; it's an override of System.Diagnostics.TraceListener and it raises the event TraceCatched whenever a trace is written.

See an example in project SampleWpfApplicationTests in this repository.

Class diagram

Class diagram

How to use it?

The simplest way is to use BindingExceptionThrower because it handles everything for you:

BindingExceptionThrower.Attach()

That's all.
Once you called Attach(), every WPF binding error will raise a BindingException. See an example in project SampleWpfApplication in this repository.

However, if you want to be aware of binding errors without throwing an exception, you can use BindingErrorListener and attach to the ErrorCatched event.

using( var listener = new BindingErrorListener())
{
    listener.ErrorCatched += msg => Console.WriteLine("Binding error: {0}", msg);

    // ...do what you want here...
}
Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.
  • net8.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on WpfBindingErrors:

Repository Stars
Drommedhar/DlssUpdater
DlssUpdater is a tool to conveniently configure all 3 instances of DLSS libraries (Upscaling, Ray Reconstruction, Frame Generation) used by your games.
Version Downloads Last Updated
1.2.0 658 8/22/2025
1.1.0 135,119 10/2/2019
1.0.0 33,853 8/11/2015
0.1.0 2,052 4/13/2015

Updated to target .NET 8 and .NET Framework 4.8. These are current LTS versions.