-
-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Antoine Aubry
committed
Sep 28, 2019
1 parent
a792b3f
commit eee32fd
Showing
2 changed files
with
97 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Release 7.0.0 | ||
|
||
Added support for **nullable references** and **netstandard 2.1**. | ||
|
||
Enabling nullable references exposed many potential bugs where the code assumed | ||
that a reference would not be null, but where it was possible for it to be null. | ||
In most cases this did not cause an error because of the way the code was being used. | ||
|
||
Because fixing these problems required some breaking changes, a few improvements were made to the code base to take advantage of modern C# constructs. | ||
|
||
Overall, the following **breaking changes** were made: | ||
|
||
- **Removed the default constructor from most exceptions**, because that would cause some uninitialized properties. | ||
|
||
- Made the **`ParsingEvent` concretizations sealed**. There is no point in inheriting from these because the library assumes that they form a closed set. | ||
|
||
- **Made many classes sealed**, since they are not intended to be extended. | ||
|
||
- **`YamlDocument` now throws an exception** if is has no root node after loading. This should only happen when loading from an `IParser` that returns invalid data or is in an invalid state. | ||
|
||
The following APIs were made **obsolete** (but still work as before): | ||
|
||
- Refactored the **extension methods to `IParser`** to have better names with a more sensible semantic. The previous extension methods, `Expect<T>`, `Allow<T>`, `Peek<T>` and `Accept<T>` are still available but have been deprecated. The new extension methods are: | ||
|
||
- `T Consume<T>() where T : ParsingEvent` | ||
Ensures that the current event is of the specified type, returns it and moves to the next event. Throws an exception if the next event is not of the expected type. | ||
|
||
- `bool TryConsume<T>(out T @event) where T : ParsingEvent` | ||
If the event is of the specified type, returns it and moves to the next event, otherwise returns null. | ||
|
||
- `T Require<T>() where T : ParsingEvent` | ||
Enforces that the current event is of the specified type. | ||
|
||
- `bool Accept<T>(out T @event) where T : ParsingEvent` | ||
Checks whether the current event is of the specified type. | ||
|
||
- Made the **constructor of all naming conventions obsolete**. Instead each has a static property named `Instance`. There was no point in creating multiple instances of those classes. | ||
Instead of: | ||
```c# | ||
new SerializerBuilder() | ||
.WithNamingConvention(new CamelCaseNamingConvention()); | ||
``` | ||
Use: | ||
```c# | ||
new SerializerBuilder() | ||
.WithNamingConvention(CamelCaseNamingConvention.Instance); | ||
``` | ||
|