unosquare / embedio

A tiny, cross-platform, module based web server for .NET
http://unosquare.github.io/embedio
Other
1.46k stars 176 forks source link

More steps towards version 4.0 #444

Closed rdeago closed 4 years ago

rdeago commented 4 years ago

Some breaking changes were required to fix some issues introduced by the use of nullable reference types. The most painful is probably the change in session data semantics: whereas in EmbedIO version 3 the ISession[] getter returned null for non-existent keys, now session data behave as a "real" dictionary, thus throwing KeyNotFoundException.

Unfortunately there was no way around it any longer (or should I say, we stopped getting away with such bad practice) the day IDictionary<,> and IReadOnlyDictionary<,> got their nullability annotations, breaking Swan.Collections.IDataDictionary<,> beyond repair.

Another relevant breaking change is that RouteMatcher.Match does not return null any more if a match fails: instead, it returns RouteMatch.None. Instead of checking for a null return value, users of RouteMatcher can use the newly-introduced RouteMatch.IsMatch property to determine whether a match was successful.

Other breaking changes were mostly at a binary level, only requiring recompilation of dependent projects.

This PR also marks the point in history when there are no more compiler warnings in EmbedIO - except for legacy code ported from Mono and WebSocketSharp, and the Security namespace that is going to be refactored anyway.