Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bblanchon/wpfbindingerrors

:boom: Turn WPF Binding errors into exception
https://github.com/bblanchon/wpfbindingerrors

c-sharp mvvm wpf xaml

Last synced: 8 days ago
JSON representation

:boom: Turn WPF Binding errors into exception

Awesome Lists containing this project

README

        

Turn WPF binding errors into exceptions
=======================================

A lightweight library that converts WPF binding errors into exceptions, so you can quickly spot errors in the XAML markup and detect them unit tests.

![Exception shown in Visual Studio](SampleWpfApplication/Pictures/XamlParseException.png)

All it requires is a single line in your existing code:

```csharp
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs args)
{
base.OnStartup(args);

// Start listening for WPF binding error.
// After that line, a BindingException will be thrown each time
// a binding error occurs.
BindingExceptionThrower.Attach();
}
}
```

Installing:
-----------

With .NET CLI

> dotnet add package WpfBindingErrors

With Package Manager:

PM> Install-Package WpfBindingErrors

https://www.nuget.org/packages/WpfBindingErrors

Content
-------

1. [Project WpfBindingError](WpfBindingErrors) is a reusable assembly that listens for binding errors.
2. [Project SampleWpfApplication](SampleWpfApplication) shows how to throw `BindingException` at **runtime**.
3. [Project SampleWpfApplicationTests](SampleWpfApplicationTests) shows how to check binding errors in a **unit test project**.

Each project contains a dedicated README with more detail.

Supported frameworks
--------------------

* .NET Core 3.0 🆕
* .NET Framework 4.6
* .NET Framework 4.5.2
* .NET Framework 4.5.1
* .NET Framework 4.5
* .NET Framework 4.0

Contributors
------------

* [Gareth Brown](https://github.com/wonea)
* [Bruno Juchli](https://github.com/jongleur1983)